changing default color of buttons and active radio buttons

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

changing default color of buttons and active radio buttons

Postby ahsan78 » Sat Apr 11, 2009 9:24 am

is there anyone who can help? i need to change the default color of buttons(both in prssed and unpressed condition). Also need to change the green color of active radio button

if the background color of a button is changed, the button's appearance becomes flat.

please help...
ahsan78
Freshman
Freshman
 
Posts: 2
Joined: Sat Apr 11, 2009 8:58 am

Top

Postby stifry » Mon Apr 13, 2009 4:57 pm

You can use a selector that specifies the drawable for the various button states:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. <?xml version="1.0" encoding="utf-8"?>
  3.  
  4. <selector xmlns:android="http://schemas.android.com/apk/res/android">
  5.  
  6.         <item android:state_pressed="true" android:drawable="@drawable/btn_minus_pressed" />
  7.  
  8.     <item android:state_focused="true" android:state_pressed="false"
  9.  
  10.         android:drawable="@drawable/btn_minus_selected" />
  11.  
  12.     <item android:drawable="@drawable/btn_minus_default" />
  13.  
  14. </selector>
Parsed in 0.031 seconds, using GeSHi 1.0.8.4


This is places in your drawable resources directory and you'll specify it as the button's image src.
Visit Trackaroo.com!
Trackmaster - Motorsports Lap Timer
Dynomaster - Performance Dyno
Image Image
User avatar
stifry
Developer
Developer
 
Posts: 46
Joined: Tue Feb 17, 2009 7:50 pm

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 5 guests