I my app i have many buttons,what i want is that when user selects particular button,its background should change so that user knows which button is selected.So for this i have used selectors.But when ever i run my app the event on button click works fine but the button image doesnt change
Selector
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/people_1" android:state_selected="true"></item>
<item android:drawable="@drawable/people_1" android:state_active="true"></item>
<item android:drawable="@drawable/places_1" android:state_focused="true"></item>
<item android:drawable="@drawable/hotel_icon"></item>
</selector>
Xml where i used the selector
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/hotel"
android:layout_weight="1"
android:id="@+id/home" />
0 comments:
Post a Comment