码迷,mamicode.com
首页 > 移动开发 > 详细

安卓selector

时间:2014-10-30 20:39:15      阅读:165      评论:0      收藏:0      [点我收藏+]

标签:android   style   blog   http   io   color   ar   java   for   

定义styles.xml

Xml代码  bubuko.com,布布扣
  1. <?xml version="1.0" encoding="utf-8"?>  
  2. <resources>  
  3. <style name="RoundedCornerBtn" parent="RoundedCornerView">  
  4.         <item name="android:background">@drawable/roundedcorner_btn</item>  
  5.         <item name="android:gravity">left|center_vertical</item>  
  6.         <item name="android:textColor">@android:color/black</item>  
  7.   
  8. </style>  
  9. </resources>  

 roundedcorner_btn.xml

Xml代码  bubuko.com,布布扣
  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" >  
  4.         <shape>  
  5.               <stroke android:width="2dp" android:color="@color/orange" />  
  6.               <corners android:radius="10dp" />  
  7.               <solid android:color="@color/orange"/>  
  8.         </shape>  
  9.     </item>  
  10.     <item android:state_focused="true">  
  11.         <shape>  
  12.     <stroke android:width="2dp" android:color="@color/light_gray" />  
  13.     <corners android:radius="10dp" />  
  14.     <solid android:color="@android:color/white"/>  
  15.         </shape>  
  16.     </item>  
  17.     <item >  
  18.         <shape>  
  19.     <stroke android:width="2dp" android:color="@color/light_gray" />  
  20.     <corners android:radius="10dp" />  
  21.     <solid android:color="@android:color/white"/>  
  22.     </shape>  
  23.     </item>  
  24.   
  25. </selector>  

 color.xml

Xml代码  bubuko.com,布布扣
  1. <?xml version="1.0" encoding="utf-8"?>  
  2. <resources>  
  3.     <color name="tabMedium">#2B2B2B</color>  
  4.     <color name="tabDark">#000000</color>  
  5.     <color name="tabTransparent">#10ffffff</color>  
  6.     <color name="trans">#0000</color>  
  7.     <color name="gray">#FF999999</color>  
  8.     <color name="light_gray">#FFCCCCCC</color>  
  9.     <color name="light_blue">#FFC5CCD4</color>  
  10.     <color name="blue">#0099FF</color>  
  11.     <color name="orange">#fff48b01</color>  
  12. </resources>  

 这些都是我从项目里面copy出来的,如果有问题可以找我要相应的代码

安卓selector

标签:android   style   blog   http   io   color   ar   java   for   

原文地址:http://www.cnblogs.com/lucky-star-star/p/4063396.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!