I am trying to implement the disabling of the button glow when clicked in android. I hope this is not a lost cause. Is there a way of actually implementing this? Would appreciat开发者_高级运维e a helping hand.
First create normal_button.xml in res/drawable folder.
In normal_button.xml write the code given below.
Then set the normal_button.xml as a Background for the button from the properties.
`
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" >
<color android:color="@android:color/white" />
</item>
<item >
<color android:color="@android:color/white" />
</item>
</selector>
`
Use this one
public void onClick(View v) {
yourbtnobject.setBackgroundColor(R.color.white);
}
and in value folder make a file name color and write this
<resources>
<color name="white">#ffffffff</color>
<color name="black">#ff000000</color>
<color name="green">#00C000</color>
</resources>
and on btn click which color you want to chose.
精彩评论