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
-
Twitter v3.1.1 for AndroidTwitter v3.1.1 for Android Official Twitter app for Android. Follow your interests: instant updates…
-
Jelly Bean Keyboard PRO v1.4.4Jelly Bean Keyboard PRO v1.4.4 APK Google play Store Go To Adf.ly PRO Only featur…
-
Tap Sonic 1.0.9!Stop using this version! New and updated version click here APK (1.09) Data_1 Data_2 Data_3 3 So…
-
Espier Launcher for Android PhoneEspier Launcher for Android Phone You're feeling bored with the theme and launcher your Android…
-
iWindows v1.51 S60v5iWindows v1.51 S60v5 Support/Info : Symbian^1^3 Anna Belle UnSigned Retail by DSPDA™ Details : iWin…
-
Android Apps with EclipseEclipse is the most adopted integrated development environment (IDE) for Java programmers. And, now…
-
Spectral Souls 2.4Seems like lot of user can't use the previous spectral souls i posted long before, so here v2.4…
Post a Comment
Post a Comment