Android:Button with different textcolor and background in different states
@drawable/bottom_button.xml<?xml version="1.0" encoding="utf-8"?><selector xmlns:android="http://schemas.android.com/apk/res/android" > <item android:state_enabled="false" > <color android:color="@color/download_button_disable_background"></color> </item> <item android:state_enabled="true"> <color android:color="@color/download_button_enable_background"></color> </item> </selector>
@drawable/bottom_button_textcolor.xml
<?xml version="1.0" encoding="utf-8"?><selector xmlns:android="http://schemas.android.com/apk/res/android" > <item android:state_enabled="true" android:color="@color/download_button_enable_textcolor" /> <item android:state_enabled="false" android:color="@color/download_button_disable_textcolor" /> </selector>
@style
<style name="bottom_button"> <item name="android:textColor">@drawable/bottom_button_textcolor</item> <item name="android:background">@drawable/bottom_button</item> </style>
layout.xml
<LinearLayout android:layout_width="match_parent" android:layout_height="50dp" android:layout_alignParentBottom="true" android:layout_alignParentLeft="true" android:layout_alignParentRight="true" android:layout_gravity="bottom|center_horizontal" android:background="@color/download_layout_background" android:orientation="vertical" android:paddingLeft="0dp" > <Button android:id="@+id/about_bt_update" style="@style/bottom_button" android:layout_width="wrap_content" android:layout_height="40dp" android:layout_gravity="center_horizontal" android:layout_margin="7dp" android:text="@string/update" /> </LinearLayout>
You must Sign up as a member of Effecthub to view the content.
Latest Posts
- Android: CookieManager removeAllCookie() Crash
- XlistView: A listview which can pull to refresh and load more (1)
- Millions of Android Phones Could Be Affected by the Heartbleed Bug. Check to See if Yours Is One of Them
- TOP 10 ANDROID GAMES FOR MARCH 2014
- Android:Button with different textcolor and background in different states
5246 views 3 comments
You must Sign up as a member of Effecthub to join the conversation.
This was really helpful! Thank you so much!
grilled chicken temp>