Question

Hello I am trying to get Nine patch drawable from this tool Android Asset Studio, it generated the drawables of different density and that drawable I am setting as background of the button but drawables it generated has border line around images in four side that appear also when I am trying to run application in device.

Why it is so and can you please tell how this can avoided ?

<Button
    android:id="@+id/submitButton"
    android:layout_width="match_parent"
    android:contentDescription="@null"
    android:layout_height="wrap_content"
    android:layout_marginTop="@dimen/sign_up_views_vertical_top_margin"
    android:background="@drawable/sign_up_via_email_selector" />

sign_up_via_email_selector.xml

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">

    <item android:drawable="@drawable/sign_up_submit" />

</selector>

enter image description here

Thanks in advance

Was it helpful?

Solution

Check to see if the image has the correct name.

It should be sign_up_submit.9.png, the lines that appear are actually the areas that the 9patch defines for stretch.

If the image has the correct name it is a chance that the online utility application you used messed the resource. Try to use the 9patch generator from the android sdk(look for [your_sdk_path]\tools\draw9patch.bat), and try to generate one yourself and see if the problem is still there.

OTHER TIPS

can you please check how you placed your 9 patch image in drawable folder,9 patch image should be named sign_up_submit.9.png

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top