Friday, February 22, 2013

Standard Android Button with a different color


Add this file into drawable folder in res folder 

red_button.xml

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
"1.0" encoding="utf-8"?>
 
    "true" >
        
            
                android:startColor="#FFFFFF"
                android:endColor="#FFEEEE"
                android:angle="270" />
            
                android:width="2dp"
                android:color="#454545" />
            
                android:radius="3dp" />
            
                android:left="10dp"
                android:top="10dp"
                android:right="10dp"
                android:bottom="10dp" />
        
    
 
    "true" >
        
            
                android:endColor="#FF0000"
                android:startColor="#AA0000"
                android:angle="270" />
            
                android:width="2dp"
                android:color="#FFFFFF" />
            
                android:radius="3dp" />
            
                android:left="10dp"
                android:top="10dp"
                android:right="10dp"
                android:bottom="10dp" />
        
    
 
           
        
            
                android:endColor="#FF0000"
                android:startColor="#AA0000"
                android:angle="270" />
            
                android:width="2dp"
                android:color="#454545" />
            
                android:radius="3dp" />
            
                android:left="10dp"
                android:top="10dp"
                android:right="10dp"
                android:bottom="10dp" />
        
    

And set background to button like
?
1
2
3
  android:background="@drawable/red_button" android:layout_margin="10dp"
  android:layout_width="fill_parent" android:layout_height="wrap_content">


That's it !!

No comments:

Post a Comment