android开发文档之resource-drawable用法
2013-04-22 11:28
429 查看
Android developer文档中有对resource的drawable进行详细介绍
现在我们就一一介绍:
A bitmap file is a
Android creates a
any of these files when you save them in the
文件路径
or
The filename is used as the resource ID.compiled resource datatype:Resource pointer to a
In XML:
The following application code retrieves the image as a
Drawable drawable = res.
现在我们就一一介绍:
Bitmap File
A bitmap file is a .png,
.jpg, or
.giffile.
Android creates a
Drawableresource for
any of these files when you save them in the
res/drawable/directory.
文件路径
res/drawable/filename.png(
.png,
.jpg,
or
.gif)
The filename is used as the resource ID.compiled resource datatype:Resource pointer to a
BitmapDrawable.引用方式:In Java:
R.drawable.filename
In XML:
@[package:]drawable/filenameexample:With an image saved at
res/drawable/myimage.png, this layout XML applies the image to a View:
<ImageView android:layout_height="wrap_content" android:layout_width="wrap_content" android:src="@drawable/myimage" />
The following application code retrieves the image as a
Drawable:
Resources res = [code]getResources();
Drawable drawable = res.
getDrawable(R.drawable.myimage);[/code]
相关文章推荐
- android中setBackgroundResource和setBackgroundDrawable和用法
- Android DrawableShape资源的用法,Shape属性,Shape开发
- Android setBackgroundResource和setBackgroundDrawable和用法
- 从零开始学android开发-setBackgroundDrawable与setBackgroundResource的区别
- Android 3.1 r1 中文API文档 (121) —— ResourceCursorTreeAdapter
- Android开发——DiskLruCache用法详解以及工作原理深度解析
- android开发之interpolator的用法详解
- Android帮助文档翻译——开发指南(十五)获取用户位置
- Android开发中Handler用法总结
- Android Drawable 那些不为人知的高效用法
- Android官方开发文档Training系列课程中文版:网络操作之网络连接
- android 4.0 BLE开发官方文档介绍
- Android Drawable 那些不为人知的高效用法
- Android官方开发文档Training系列课程中文版:分享文件之分享一个文件
- android开发 ArrayList用法
- 打开android开发doc文档过慢的问题(万恶的墙)
- Android开发总结笔记 Drawable (下) 3-3
- android开发问题bitmap drawable一直会自动缩放
- Android开发引入项目报invalid resource directory name bin/res/crunch”错误
- Android开发之drawable中的命名问题