androidxmlbackgroundnine-patch

Android nine-patch not being recognized on device


I just made a nine-patch

it is saved like border.9.png from the draw 9 patch tool.

in my android layout editor, it shows up like it is going to be a proper 9 patch graphic, stretched out yet not pixelated.

yet on a real device, it just shows a giant stretched image, with the 9patch guides seen, it looks really bad

whats going on??? and how do I fix it

my xml:

<LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@drawable/border"
        android:orientation="vertical"
        android:padding="35dip" >

Solution

  • You can find all the necessary information how to create a 9.patch here

    Your background should be like this

    nine patch background

    Note: the markers to the bottom and right need to be drawn as complete lines, not single dots.

    Edit
    Seems that uploading the 9.patch here becomes altered, and cannot be used as a 9.patch anymore.
    You can download the functional version from here