Android 中各种XML文件的作用


1、arrays.xml     定义数组

1 <resources>
2  <string-array name="proxy_types">
3  <item>HTTP</item>
4  <item>SOCKS4</item>
5  <item>SOCKS5</item>
6 </string-array> 
7 </resources>

 

2、colors.xml 定义颜色

 1 <resources>
 2  <color name="blue_sky">#A0C8FF</color>
 3  <color name="vert_manu">#CCFF00</color>
 4  <color name="black">#000000</color>
 5  <color name="white">#FFFFFF</color>
 6  <color name="red">#FF0000</color>
 7  <color name="link_color">#FF0066CC</color>
 8  <color name="simiple_button_color">#FFF</color>
 9  <color name="blue">#0000FF</color>
10  <color name="grey">#FFCBD2D8</color>
11  </resources>

 

3、dimens.xml   定义尺寸

1 <resources>
2          <dimen name="bottom_tab_font_size">12dp</dimen>
3          <dimen name="bottom_tab_padding_up">5dp</dimen>
4          <dimen name="bottom_tab_padding_drawable">8dp</dimen>
5  </resources>

 

4、drawables.xml 定义画布

1 <resources>
2       <item type="drawable" name="shader1">#7f7f7f7f</item>
3          <item type="drawable" name="highlight">#cf7f7f7f</item>
4      <item type="drawable" name="barbg">#ef0a4267</item>
5      <item type="drawable" name="trans">#00000000</item>
6      <item type="drawable" name="chatdivider">#ffd6dadc</item>
7  </resources>

 

5、strings.xml 定义字符串

1 <resources>
2         <string name="app_name">Beem</string>
3         <string name="OkButton">Ok</string>
4         <string name="ClearButton">Clear</string>
5  </resources>

 

6、styles.xml 定义样式

1 <resources>
2          <style name="Label">
3                  <item name="android:textSize">18sp</item>
4                  <item name="android:textStyle">bold</item>
5                  <item name="android:typeface">sans</item> 
6                  <item name="android:focusable">false</item>  
7                  <item name="android:padding">12dip</item>
8          </style>
9  </resources>

 

7、phoinix_popumenu_style.xml     selector选择

1 <selector xmlns:android="http://schemas.android.com/apk/res/android">
2      <item android:state_focused="true" android:state_pressed="true"  android:drawable="@drawable/phoinix_pushmail_btn_selected" />
3      <item android:state_focused="false" android:state_pressed="true"  android:drawable="@drawable/phoinix_pushmail_btn_selected" />
4      <item android:state_focused="true" android:drawable="@drawable/phoinix_small_selected"/>
5  </selector>

 

8、menu 菜单

 1 <menu xmlns:android="http://schemas.android.com/apk/res/android">
 2          <group>
 3                         <item android:id="@+id/chat_menu_contacts_list" android:visible="true"
 4                          android:title="@string/chat_menu_contacts_list" android:icon="@drawable/ic_menu_friendslist" />
 5                          
 6                          <item android:id="@+id/chat_menu_change_chat" android:visible="true"
 7                          android:title="@string/chat_menu_change_chat" android:icon="@drawable/ic_menu_chat_dashboard" />
 8          </group>
 9          
10         <item android:id="@+id/chat_menu_close_chat" android:visible="true"
11          android:title="@string/chat_menu_close_chat" android:icon="@drawable/ic_menu_end_conversation" />
12 
13 </menu>

 

9、drawable  white_background.xml  白色圆角矩形做背景

 1 <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> 
 2 
 3     <solid android:color="#FFFFFF" /> 
 4 
 5     <corners android:topLeftRadius="5px" 
 6          android:topRightRadius="5px" android:bottomLeftRadius="5px" 
 7          android:bottomRightRadius="5px"/> 
 8 
 9    <!--   <padding android:left="10dp" android:top="10dp" android:right="10dp" 
10                         android:bottom="10dp" />  
11 
12           <stroke   
13              android:dashWidth="2dp"   
14              android:dashGap="2dp"  
15              android:width="2dp"   
16              android:color="#FF00ff00"></stroke>  --> 
17 </shape>

 


10、anim  旋转动画

 1 <set xmlns:android="http://schemas.android.com/apk/res/android">  
 2       
 3 <rotate   
 4    android:interpolator="@android:anim/accelerate_decelerate_interpolator"  
 5    android:fromDegrees="0"   
 6    android:toDegrees="+360"  
 7    android:duration="3000" />  
 8 
 9  <!-- rotate 旋转动画效果  
10 
11         属性:interpolator 指定一个动画的插入器,用来控制动画的速度变化  
12 
13         fromDegrees 属性为动画起始时物件的角度      
14         toDegrees   属性为动画结束时物件旋转的角度,+代表顺时针  
15         duration  属性为动画持续时间,以毫秒为单位  
16 -->  
17  </set> 

 

转载于:https://www.cnblogs.com/totome/archive/2012/08/30/2663426.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值