4

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"/>

Zach Sperske
  • 658
  • 9
  • 28
  • 1
    Probably related to http://stackoverflow.com/questions/28737164/9patch-on-lollipop-not-working-as-expected?rq=1 – user2864740 Jul 10 '15 at 22:22

1 Answers1

2

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

android:stateListAnimator="@null"

Hope it helped.

Rick
  • 3,943
  • 6
  • 33
  • 45
  • Thanks, but it would be much appreciated if you would have explain why the background was showing and how setting stateListAnimator to null solved it! – Muhammad Babar Jan 22 '16 at 06:28