android开发文档之resource-drawable用法
来源:互联网 发布:java创建对象 编辑:程序博客网 时间:2024/06/05 12:02
Android developer文档中有对resource的drawable进行详细介绍
现在我们就一一介绍:
Bitmap File
A bitmap file is a .png
, .jpg
, or .gif
file. Android creates a Drawable
resource 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/filename
- example:
- 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 =
getResources()
;Drawable drawable = res.getDrawable
(R.drawable.myimage);
- android开发文档之resource-drawable用法
- Android系统Resource之Drawable
- Android Resource Types之Drawable简介
- 关于Android Drawable Resource
- Android 开发之 Drawable系列
- Android Drawable Resource目录-概要
- Android Drawable Resource 学习笔记
- Android Drawable Resource学习(一)、Drawable Resource简介
- Android Drawable Resource学习(一)、Drawable Resource简介
- Android Drawable Resource学习(一)、Drawable Resource简介
- Android Drawable Resource学习(一)、Drawable Resource简介
- Android Drawable Resource学习(一)、Drawable Resource简介
- Android Drawable Resource学习(一)、Drawable Resource简介
- Android Drawable Resource学习(一)、Drawable Resource简介
- Android样式的开发之drawable
- Android开发学习之路--Drawable mutations
- Android开发素材之drawable妙用
- android开发 之常用的drawable(一)
- 常见的vc++编译错误
- ffmpeg文档1:制作屏幕录像
- udf udaf udtf
- Oracle 远程连接访问出错ORA-01031:Insufficient privileges!
- 递归回溯 暴力枚举 (总结)
- android开发文档之resource-drawable用法
- ADO 访问SQL数据库
- IIS7集成模式初始化Spring.NET容器(Request is not available in this context exception in Application_Start问题)
- OpenStack安装部署管理中常见问题解决方法(OpenStack-Lite-FAQ)
- #pragma once相关
- ffmpeg文档2:输出到屏幕
- Java/编程规范
- 解决listview的item为自定义viewgroup时,viewgroup子view press时,整个viewgroup都被按下的问题
- 我姐和我女友是如何学编程的