android - 'colorButtonNormal' working as on press state -


i customizing button style

<style name="custom_button" parent="@android:style/widget.button">     <item name="android:paddingtop">5dp</item>     <item name="android:paddingbottom">5dp</item>     <item name="android:textallcaps">false</item>     <item name="colorbuttonnormal">#f37022</item>     <item name="android:textcolor">#ffffff</item> </style> 

using

<button        android:layout_width="match_parent"        android:layout_height="wrap_content"        android:text="prepaid package"        style="@style/custom_button"/>` 

but color on colorbuttonnormal has appears on on press state.

what now?

i have taken example here.

custom background

if want customise background depending on state of button:

create xml file eg button_custom.xml in res/drawable/

<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android">     <item android:drawable="@drawable/button_pressed"         android:state_pressed="true" />     <item android:drawable="@drawable/button_focused"         android:state_focused="true" />     <item android:drawable="@drawable/button_default" /> </selector> 

then actual button, add: can incorporate default custom background.

<button    ...     android:background="@drawable/button_custom"  /> 

also in styles, fix background color of custom button style:

<item name="android:background">#f37022</item> 

"colorbuttonnormal" not attribute of button, need use built in attributes, have other items.


Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -