Problem with nine StateListDrawable errors

After upgrading to SDK version 15 of version 12, my EditTexts and Buttons all look distorted like this ...

How it looks nowHow it used to look

Now is this a bug with the revision? . When I look at what the layout with the Graphic Layout tab looks like, it looks fine. But as soon as it is compiled and placed on my phone or emulator, it is distorted.

Here is for StateListDrawable xml for buttons. Each link to this is 9patch . EditTexts is done in the same way.

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:drawable="@drawable/button_grey_pressed" android:state_pressed="true"></item>
    <item android:drawable="@drawable/button_grey_pressed" android:state_focused="true"></item>
    <item android:drawable="@drawable/button_grey_pressed" android:state_selected="true"></item>
    <item android:drawable="@drawable/button_grey_default"></item>
</selector>
+5
source share
3 answers

This is the problem that I encountered when I upgraded to SDK 14.

Window>Preferences>Android>Build, "Build output" Normal, Project>Clean>Clean All.

+2

, :

  • , .
  • .
  • .
  • .
  • .
+1

Try wrapping these nine-patch drawings (I suppose @drawable/button_grey_pressedapplies to /drawable/button_grey_pressed.9.png) in xml files with nine patches:

<?xml version="1.0" encoding="utf-8"?>
<nine-patch xmlns:android="http://schemas.android.com/apk/res/android"
    android:src="@drawable/button_grey_pressed"
    android:dither="true" />

You will need to give this xml file a name that will be different from the name button_grey_pressed.9.png, saybutton_grey_pressed9.xml

0
source

All Articles