I've been dealing with this recently because I wanted to put two textviews in a button. You have to choose:
- Extend Button class and use it in your layout
Use a Layout insted of a button and drag inside everithing you need and make it clickable by adding this parametter to it:
android:clickable="true"
After that you can modify te apperance of your layout by defining the
android:background="@drawable/my_background"
to give to it a "button-like" face and behavior
/res/drawable/mi_background.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_focused="true" android:drawable="@color/black"/>
<item android:state_pressed="true" android:state_enabled="false" android:drawable="@color/black" />
<item android:drawable="@color/white"/>
</selector>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…