android getResources的作用
来源:互联网 发布:激活win10专业版网络 编辑:程序博客网 时间:2024/05/08 23:11
http://my.oschina.net/u/874134/blog/158606
今天做一个Android的文件管理器,里面用到很多的地方用到了getResources。
- Drawable
currentIcon null;= - currentIcon
= getResources().getDrawable(R.drawable.folder); - currentIcon
= getResources().getDrawable(R.drawable.image);
- Resources
myResources = getResources(); - InputStream
myFile = myResources.openRawResource(R.raw.myfilename);
和传统的java文件操作一样,在androidApi中提供了openFileInput和openFileOutput方法来读取设备上的文件。
简写
- InputStream
fs this.getResources().openRawResource(R.raw.kb);= (资源文件名为kb.html, 不需要带后缀.html) - InputStreamReader
read = new InputStreamReader (fs,”gb2312″); - BufferedReader
in = new BufferedReader(read);
读取res/drawable目录下的png或者bmg
- //得到Resources对象
- Resources
r = this.getContext().getResources(); - //以数据流的方式读取资源
- Inputstream
is = r.openRawResource(R.drawable.my_background_image); - BitmapDrawable
bmpDraw = new BitmapDrawable(is); - Bitmap
bmp = bmpDraw.getBitmap();
0 0
- android getResources的作用
- android getResources的作用
- Android getResources的作用和需要注意点
- Android getResources的作用和需要注意点 .
- Android getResources的作用和需要注意点
- Android getResources的作用和需要注意点
- Android getResources的作用和需要注意点
- Android getResources的作用和需要注意点
- Android getResources的作用和需要注意点
- Android getResources的作用和需要注意点
- Android getResources的作用和需要注意点
- Android getResources()
- android getResources
- Android中getResources().getDrawable() 过时的解决方法
- Android中getResources().getDrawable() 过时的解决方法
- Android 中Parcelable的作用
- Android --- 读取系统资源 getResources
- Android getResources().getStringArray() variables
- 自动完成文本框AutoCompleteTextVi…
- Spinner的功能和用法-通过XML生成
- Android日期选择组件与时间选择组…
- Android进度条样式
- Android当中Handler的使用
- android getResources的作用
- layer-list使用
- Word通配符
- 利用word通配符将手机号替换为*
- Android进度条实例-实现模拟下载进…
- 显示在标题上的进度条
- 拖动条SeekBar的功能和用法
- SeekBar实例-通过SeekBar调整图片…
- 星级评分条RatingBar的介绍