Search code examples
androiddrawablenine-patch

How to use an png-image as 9-patch-png in Android?


we wanna use png-images as background in a selector:

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_focused="true" android:drawable="@drawable/inputfield_text_bg_active" />
    <item android:drawable="@drawable/inputfield_text_bg" />
</selector>

where inputfield_text_bg_active and inputfield_text_bg are our png-images

And there is the problem with stretching, it doesn't look nice.

Is there a way to use this pngs without converting them to 9-patch-png?


Solution

  • I think this links are helpful for u

    http://developer.android.com/guide/developing/tools/draw9patch.html

    http://www.android10.org/index.php/articlesother/279-draw-9-patch-tutorial