android 常用效果

From:http://blog.csdn.net/jjdujiang/article/details/53078725

[html]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. <?xml version="1.0" encoding="utf-8"?>  
  2. <selector xmlns:android="http://schemas.android.com/apk/res/android">  
  3.     <item   
  4.         android:state_checked="true"   
  5.         android:drawable="@drawable/togglebutton_on" />  
  6.     <item android:drawable="@drawable/togglebutton_off" />  
  7. </selector>  
ToggleButton

ImageButton,默认状态下背景色为白色,点击时背景色位灰色

[html]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. <?xml version="1.0" encoding="utf-8"?>  
  2. <selector xmlns:android="http://schemas.android.com/apk/res/android" >  
  3.     <item android:state_pressed="true" android:drawable="@color/lightgray" />  
  4.     <item android:state_pressed="false" android:drawable="@color/white" />  
  5. </selector>  

圆角矩形

[html]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. <?xml version="1.0" encoding="utf-8"?>  
  2. <shape xmlns:android="http://schemas.android.com/apk/res/android" >  
  3.       
  4.     <solid android:color="#FFFFFF" />      
  5.     <corners android:topLeftRadius="5dp"     
  6.              android:topRightRadius="5dp"      
  7.              android:bottomRightRadius="5dp"     
  8.              android:bottomLeftRadius="5dp"/>  
  9.     <stroke   
  10.         android:width="1dp"  
  11.         android:color="@color/gray" />  
  12. </shape>  


圆角蓝色按钮,模仿以前版本的QQ

[html]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. <?xml version="1.0" encoding="utf-8"?>  
  2. <selector xmlns:android="http://schemas.android.com/apk/res/android" >  
  3.     <item android:state_pressed="true" android:drawable="@drawable/button_getinstrument_presstrue"/>  
  4.     <item android:state_pressed="false" android:drawable="@drawable/button_getinstrument_pressfalse"/>  
  5. </selector>  

[html]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. <?xml version="1.0" encoding="utf-8"?>  
  2. <shape xmlns:android="http://schemas.android.com/apk/res/android" >  
  3.   
  4.     <!-- 边角的圆弧半径 -->  
  5.     <corners android:radius="2dp" />  
  6.       
  7.     <!-- 实心填充 -->  
  8.     <solid android:color="#3366cc"/>  
  9.       
  10.     <!-- 描边:一般大小都是1dp -->  
  11.     <stroke   
  12.         android:width="1dp"  
  13.         android:color="@color/gray" />  
  14.   
  15. </shape>  


[html]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. <?xml version="1.0" encoding="utf-8"?>  
  2. <shape xmlns:android="http://schemas.android.com/apk/res/android" >  
  3.   
  4.     <!-- 边角的圆弧半径 -->  
  5.     <corners android:topLeftRadius="2dp"     
  6.              android:bottomLeftRadius="2dp"  
  7.              android:topRightRadius="2dp"      
  8.              android:bottomRightRadius="2dp"     
  9.              />  
  10.       
  11.     <!-- 实心填充 -->  
  12.     <solid android:color="#6699ff"/>  
  13.       
  14.     <!-- 描边:一般大小都是1dp -->  
  15.     <stroke   
  16.         android:width="1dp"  
  17.         android:color="@color/gray" />  
  18.   
  19. </shape>  
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值