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开发人员不得不收集的代码(持续更新中)
  2. Android使用Application总结
  3. 禁止android显示状态栏
  4. Android清除本地数据缓存代码
  5. Android使用ListView使用
  6. Android(安卓)TabHost使用、动态加载内容
  7. 利用Handler来更新android的UI
  8. 移植 libusb 到 Beagleboard 上的 Android
  9. ReactNative调用原生封装的代码和控件

随机推荐

  1. 【前端词典】8 个提高 JS 性能的方法
  2. 辞职后才明白的10个道理
  3. 15个炫酷的CSS3加载动画图标
  4. 【前端词典】这些功能其实不需要 JS,CSS
  5. 在阿里年薪百万,回到家洗衣做饭,媳妇太厉害
  6. HTML5实现的瀑布动画,超逼真
  7. HTML5爱心表白动画 程序员也浪漫
  8. 阿里这几年真是越来越没人情味了
  9. 【前端词典】三种处理滚动穿透问题方案的
  10. Ansible 之 yum安装