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.
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>
Download the files.
-- Delivered by Feed43 service
Related Posts
There is no other posts in this category.Popular
-
Winamp v0.9.2 For AndroidWinamp v0.9.2 For Android Requirements: Android 2.1 Overview: If you already have the official app …
-
DocScanner for Symbian MobilesDocScanner for Symbian Mobiles DocScanner is a perfect business application to have on your Symbia…
-
[Android] Battleloot Adventure HD v1.0.7 (apk + data)In Battleloot Adventure HD , let's roll out and your adventure is about to begin. In the kingdo…
-
Motorola Photon 4GPhoton 4G by Motorola will debut as Sprint’s first international 4G smartphone for $199.99 with ne…
-
[Gameloft] Ice Age 4: Continental Drift S40v6, S60v3, v5, Samsung, LG, Sony EricsionIce Age 4: Continental Drift is the latest game just released by Gameloft in this June 2012. The g…
-
Death Worm v1.09 Iphone-Ipad-Ipod TouchDeath Worm v1.09 Iphone-Ipad-Ipod Touch Over 3,000,000 of downloads for Death Worm, 3 Million peopl…
-
Android Applications That Contains a VirusAndroid Applications That Contains a Virus Symantec has just released a list of applications that c…
Post a Comment
Post a Comment