In layout/main.xml :

    <Button
        android:id="@+id/original"
        android:background="@drawable/sample"
        android:text="Original" />

create the sample.xml inside drawable directory paste the following code 
and copy 2 images to drawable directory with name color_1 and color_2:

<?xml version="1.0" encoding="utf-8"?> 
  <selector xmlns:android="http://schemas.android.com/apk/res/android";> 

      <item 
          android:state_focused="false" 
          android:state_pressed="true" 
          android:drawable="@drawable/color_1" />
       
      <item android:drawable="@drawable/color_2" /> 
  </selector>

Build and run ...



On Tuesday, 21 May 2013 16:27:37 UTC+5:30, Sadhna Upadhyay wrote:
>
> Hi friends can some one tell me how to change tab background on click
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to