when click on Button or TextView or may be layout, when click then change background color. purpose of this, user can detect click or not on button.
when press button then color should be changed.
inside res/drawable/press_background_color.xml
create xml file inside drawable folder
Now : press_background_color.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/white" android:state_selected="true"></item>
<item android:drawable="@color/header" android:state_pressed="true"></item>
<item android:drawable="@color/white"></item>
</selector>
Default color show different and after click show different.
User this File by background:
android:background="@drawable/press_background_color"
No comments :
Post a Comment