`
deepfuture
  • 浏览: 4335156 次
  • 性别: Icon_minigender_1
  • 来自: 湛江
博客专栏
073ec2a9-85b7-3ebf-a3bb-c6361e6c6f64
SQLite源码剖析
浏览量:79439
1591c4b8-62f1-3d3e-9551-25c77465da96
WIN32汇编语言学习应用...
浏览量:68419
F5390db6-59dd-338f-ba18-4e93943ff06a
神奇的perl
浏览量:101543
Dac44363-8a80-3836-99aa-f7b7780fa6e2
lucene等搜索引擎解析...
浏览量:281288
Ec49a563-4109-3c69-9c83-8f6d068ba113
深入lucene3.5源码...
浏览量:14620
9b99bfc2-19c2-3346-9100-7f8879c731ce
VB.NET并行与分布式编...
浏览量:65620
B1db2af3-06b3-35bb-ac08-59ff2d1324b4
silverlight 5...
浏览量:31339
4a56b548-ab3d-35af-a984-e0781d142c23
算法下午茶系列
浏览量:45234
社区版块
存档分类
最新评论

android-对资源的使用

阅读更多

1、java

1)字符串

String mystr=activity.getString(R.string.test_string);

textView.setText(simpleString);

2)尺寸

float dimen=activity.getResouces().getDimension(R.dimen.mysize_in_pixels);

3)图像资源

BitmapDrawable d=acitivity.getResouces().getDrawable(R.drawable.sample_image);

4)色图资源

ColorDrawble redDrawable=(ColorDrawble) activity.getResources().getDrawable(R.drawable.redrectangle);

 

 

2、xml

1)字符串

<TextView android:layout_width="fill_parent"

                 android:layout_height="wrap_content"

                 android:textAlign="center"

                 android:text="@string/tagged_string"/>

2)尺寸

<TextView android:layout_width="fill_parent"

                 android:layout_height="wrap_content"

                 android:textSize="@dimen/mediu_szie"/> 

 

3)图像资源

 

adroid:background="@drawable/sample_image"  

4)色图资源

android:background="@drawable/red_rectangle"

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics