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. <item android:id="@+id/chat_menu_change_chat" android:visible="true"
  6. android:title="@string/chat_menu_change_chat" android:icon="@drawable/ic_menu_chat_dashboard" />
  7. </group>

  8. <item android:id="@+id/chat_menu_close_chat" android:visible="true"
  9. android:title="@string/chat_menu_close_chat" android:icon="@drawable/ic_menu_end_conversation" />

  10. </menu>
复制代码

9、drawablewhite_background.xml白色圆角矩形做背景
  1. <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">

  2. <solid android:color="#FFFFFF" />

  3. <corners android:topLeftRadius="5px"
  4. android:topRightRadius="5px" android:bottomLeftRadius="5px"
  5. android:bottomRightRadius="5px"/>

  6. <!-- <padding android:left="10dp" android:top="10dp" android:right="10dp"
  7. android:bottom="10dp" />

  8. <stroke
  9. android:dashWidth="2dp"
  10. android:dashGap="2dp"
  11. android:width="2dp"
  12. android:color="#FF00ff00"></stroke>-->
  13. </shape>
复制代码


10、anim旋转动画
  1. <set xmlns:android="http://schemas.android.com/apk/res/android">

  2. <rotate
  3. android:interpolator="@android:anim/accelerate_decelerate_interpolator"
  4. android:fromDegrees="0"
  5. android:toDegrees="+360"
  6. android:duration="3000" />

  7. <!-- rotate 旋转动画效果

  8. 属性:interpolator 指定一个动画的插入器,用来控制动画的速度变化

  9. fromDegrees 属性为动画起始时物件的角度
  10. toDegrees 属性为动画结束时物件旋转的角度,+代表顺时针
  11. duration属性为动画持续时间,以毫秒为单位
  12. -->
  13. </set>
复制代码

更多相关文章

  1. android TextView的字体颜色设置的多种方法
  2. TTS源码解析
  3. Android(安卓)近百个项目的源代码,覆盖Android开发的每个领域
  4. Android(安卓)代码质量工具集成与应用
  5. Android深入浅出系列课程---Lesson8 Android应用程序启动
  6. android的互联网开发
  7. Android异步加载图片,并缓存到SD卡
  8. Android(安卓)OpenGL学习笔记(二)之----三角形的绘制.
  9. Android判断WIFI是否打开的方法

随机推荐

  1. android openmax hardware decoder 整合
  2. Android UI开发第三十一篇——Android的H
  3. Android小项目集合
  4. Android入门小结
  5. android开发基础------相对布局属性
  6. Android安卓41个开源项目
  7. Android基础笔记(四)-数据存储和界面展现
  8. Mac下android环境搭建
  9. Android(安卓)JNI实现fileObserver
  10. RatingBar的实现