Resource Types
16lz
2021-01-26
Each of the documents in this section describe the usage, format and syntax for a certain type of application resource that you can provide in your resources directory (res/
).
Here's a brief summary of each resource type:
- Animation Resources
- Define pre-determined animations.
Tween animations are saved inres/anim/
and accessed from theR.anim
class.
Frame animations are saved inres/drawable/
and accessed from theR.drawable
class. - Color State List Resource
- Define a color resources that changes based on the View state.
Saved inres/color/
and accessed from theR.color
class. - Drawable Resources
- Define various graphics with bitmaps or XML.
Saved inres/drawable/
and accessed from theR.drawable
class. - Layout Resource
- Define the layout for your application UI.
Saved inres/layout/
and accessed from theR.layout
class. - Menu Resource
- Define the contents of your application menus.
Saved inres/menu/
and accessed from theR.menu
class. - String Resources
- Define strings, string arrays, and plurals (and include string formatting and styling).
Saved inres/values/
and accessed from theR.string
,R.array
, andR.plurals
classes. - Style Resource
- Define the look and format for UI elements.
Saved inres/values/
and accessed from theR.style
class. - More Resource Types
- Define values such as booleans, integers, dimensions, colors, and other arrays.
Saved in
res/values/
but each accessed from uniqueR
sub-classes (such asR.bool
,R.integer
,R.dimen
, etc.). -
每一本节中的文件描述了某些类型的应用程序资源,你可以在你的资源目录(提供使用,格式和语法
RES /
)。这里的每个资源类型的简短摘要:
- 动画资源
- 定义预先确定的动画。
吐温的动画保存在RES /动画/
从访问R.anim
类。
帧动画保存在RES /绘制/
从访问R.drawable
类。 - 颜色状态列表资源
- 定义变化基于视图状态下显色的资源。
保存在RES /彩色/
从访问R.color
类。 - 绘图资源
- 定义各种图形与位图或XML。
在保存RES /绘制/
从访问R.drawable
类。 - 资源布局
- 为应用程序定义的UI布局。
保存在RES /布局/
从访问R.layout
类。 - 菜单资源
- 定义你的应用程序菜单中的内容。
保存在RES /菜单/
,并从访问R.menu
类。 - 字符串资源
- 定义字符串,字符串数组和复数形式(并包含字符串格式化和样式)。
在保存RES /价值/
从访问R.string
,R.array
和R.plurals
类。 - 样式资源
- 定义UI元素的外观和格式
保存在RES /价值/
从访问R.style
类。 - 更多资源类型
- 定义值,如布尔,整数,尺寸,颜色和其他数组。
在保存RES /价值/
但每个从独特的访问- [R
子类(如R.bool
,R.integer
,R.dimen
等)。
更多相关文章
- android自定义适配屏幕的ImageView
- Android(安卓)仿苹果自定义Dialog
- 自定义View之温度计
- Android(安卓)直接通过JNI访问驱动
- Android(安卓)-Okhttp框架 工具类
- android 7.0 user版本调试方法
- 自定义ViewGroup onMeasure onLayout
- android:根据资源查找相应控件
- Android(安卓)自定义Ratingbar