I changed the background of the button and stopped the action effect

1

I changed the background of my button to #000000 (black) and stopped performing the click demonstration (it turned blue when clicked)

<Button
   android:id="@+id/btNext2"
   android:layout_width="0dp"
   android:layout_height="match_parent"
   android:layout_weight="1"
   android:text="@string/Next"
   android:textSize="30sp"
   android:background="#000000"
   android:textColor="#ffffff"/>
    
asked by anonymous 22.10.2014 / 15:49

1 answer

3

You need a% color of this background to have button states, not simply a solid color. Create a btn_selector.xml file in your drawable directory and do something like this:

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:drawable="@android:color/darker_gray" android:state_pressed="true"/>
    <item android:drawable="@android:color/black"/>
</selector>

And in the selector button property:

android:background="@drawable/btn_selector"
    
22.10.2014 / 16:02