Reputation: 1736
I am trying to create custom Check Box button image. After some research, I came across this code sample:
<CheckBox android:id="@+id/chkFav" android:layout_width="wrap_content"
android:layout_marginRight="0dp" android:button="@drawable/checkbox"
android:layout_height="wrap_content" android:clickable="true"/>
My query is how to actually implement android:button in code.
Upvotes: 7
Views: 8359
Reputation: 3916
setButtonDrawable(Drawable d) is the way to go for. Make sure it is state-list drawable to respond to user interaction.
Step By step instruction
**Notes-- there are many ways to achieve. This is just one simple way to do it.
Upvotes: 13