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
-
Legendary Heroes v1.1.0Dota-like game! APK + Data Titanium Backup
-
How To Find And Install Applications Outside The Android Market (APK Tips)'>Android Market, home to tens of thousands of applications, is an amazing resource. However, it is n…
-
Facebook for Android v1.8.3Facebook for Android v1.8.3 Requires Android:1.5 and up Share status updates from your home screen,…
-
Zombie Defense v1.0.2Swipe screen to throw grenades, touch them to detonate. Blow some zombie heads in a thrilling ambie…
-
No Root Shakeshot Screenshot 1.0No Root Shakeshot Screenshot 1.0 APK Google play Store Go To Adf.ly ShakeShot Scr…
-
Monster Shooter v1.1 for AndroidMonster Shooter v1.1 for Android Requires Android:2.1 and up Just when you thought it couldn't …
-
Pocket Yoga v1.0.6Your personal yoga instructor, everywhere you go.The practice of yoga becomes beneficial when done …

Post a Comment
Post a Comment