Home
› Uncategorized
android.graphics.drawable.StateListDrawable lets you assign a number of graphic images to a single Drawable and swap out the visible item by a string ID value.
It can be defined in an XML file with the <selector> element. Each state Drawable is defined in a nested <item> element. For more information, see the guide to Drawable Resources.
it's a simple exercise create custom Button using StateListDrawable.
Prepare your custom button images of default, focused and pressed in /res/drawable/ folder.
Create /res/drawable/mybutton.xml to define each state Drawable.
Assign the custom button in layout using android:background="@drawable/mybutton".
Download the files.
Related:
- Create custom background for Views
It can be defined in an XML file with the <selector> element. Each state Drawable is defined in a nested <item> element. For more information, see the guide to Drawable Resources.
it's a simple exercise create custom Button using StateListDrawable.
Prepare your custom button images of default, focused and pressed in /res/drawable/ folder.
Create /res/drawable/mybutton.xml to define each state Drawable.
<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="true" android:drawable="@drawable/button_pressed" /> <item android:state_focused="true" android:drawable="@drawable/button_focused" /> <item android:drawable="@drawable/button" /> </selector> Assign the custom button in layout using android:background="@drawable/mybutton".
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" > <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:background="@drawable/mybutton" /> </RelativeLayout> Related:
- Create custom background for Views
-- Delivered by Feed43 service
Related Posts
There is no other posts in this category.Popular
-
[Android] Street Fighter 4 HD v1.0 Mod (Apk + Data)Street Fighter 4 , the true fighting game on PS3 and PC, is now available on iPhones as well as And…
-
Zombies, Run! v1.0.1You tie your shoes, put on your headphones, take your first steps outside. You’ve barely covered 10…
-
RPG Aeon Avenger - KEMCO v1.1.1The story of revenge across three eras – past, present, and future – starts now! Long ago, gods gov…
-
LG Optimus, Android Phone with compact design and Integrated Android Market ApplicationBrowse around you with LG Optimus and discover all the interesting things you've never before …
-
Final Fantasy III v1.0.2 - no rootFirst released in 1990, Final Fantasy III was the first title in the Final Fantasy series to become…
-
[Android] Kingdoms & Lords v1.3.2 APK + Data by GameloftKingdoms & Lords is the latest game released by Gameloft in the beginning of August 2012. In K…
-
Camera ZOOM FX v3.5.5 APKCamera ZOOM FX v3.5.5 Google play Store Go To Adf.ly The award-winning camera app for A…

Post a Comment
Post a Comment