Search code examples
androidandroid-5.0-lollipopnine-patchandroid-5.1.1-lollipop

9 Patch showing strange background in Lollipop


I just recently updated to api 22 and our nine patch buttons have started showing some strange behavior. What appears to be another button or some kind of border has appeared behind the button, and does a kind of lifting animation when the button is selected.

Unselected button Selected button

The bit I'm referring to is the white part you see at the right end of the button.

This is the xml.

<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false" android:drawable="@drawable/arrow_gray_button"/>
<item android:state_pressed="false" android:state_enabled="true" android:drawable="@drawable/arrow_orange_button"/>
<item android:state_pressed="true" android:state_enabled="true" android:drawable="@drawable/arrow_orange_button_pressed"/>


Solution

  • Add this to your Button in your layout to get rid of that effect.

    android:stateListAnimator="@null"
    

    Hope it helped.