String Resource的定义
来源:互联网 发布:江汉大学教务网络 编辑:程序博客网 时间:2024/06/05 18:43
看了一下,String的定义,一般包括三个:
单个的String字符串,
XML file saved at res/values/strings.xml
:
<?xml version="1.0" encoding="utf-8"?><resources> <string name="hello">Hello!</string></resources>
This layout XML applies a string to a View:
<TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/hello" />
This application code retrieves a string:
String string = getString
(R.string.hello);
You can use either getString(int)
or getText(int)
to retrieve a string.getText(int)
will retain any rich text styling applied to the string.
String 数组
XML file saved at res/values/strings.xml
:
<?xml version="1.0" encoding="utf-8"?><resources> <string-array name="planets_array"> <item>Mercury</item> <item>Venus</item> <item>Earth</item> <item>Mars</item> </string-array></resources>
This application code retrieves a string array:
Resources res =getResources()
;String[] planets = res.getStringArray
(R.array.planets_array);
复数使用,这个比较复杂,根据语言不同,各种不同,用的到时候好好学习。
另外还讲了String的格式化,包括 单双引号的显示已经format的格式,甚至包括html格式的显示,都有非常好的支持,到时候用的时候好好学吧。
0 0
- String Resource的定义
- Android Style Resource --- style样式的定义
- String的定义
- 出现should use @string resource的原因
- 实现类String的定义
- 关于string类型的定义
- should use @string resource
- 如何use @string resource
- 得到配置资源的一般做法--CLASS.getResourceAsStream(String resource)
- 关于Resources$NotFoundException: String resource ID 的异常
- String的定义不同导致的不一致
- java中形参String的可变参数的定义(String...)
- java中形参String的可变参数的定义(String...)
- java中形参String的可变参数的定义(String...)
- C++ String数组的定义问题
- String型变量的定义与引用
- String.Format的多格式定义
- “string”不包含“SubString”的定义
- HDU 1576 A/B 扩展欧几里得
- 使用百度CDN,搜索引擎抓取错误解决问题的经过
- .Net MVC后台接收xheditor上传文件,FTP文件传输
- GetPrivateProfileString
- thinkphp生成的验证码不显示问题解决
- String Resource的定义
- javascript中的常用本地对象
- 第55课:60分钟内从零起步驾驭Hive实战学习笔记
- Arcgis for js加载百度地图
- 世纪难题之--const
- 最l懒的关键字static
- 交换的练习
- Postgresql的基本操作
- 梳理caffe代码layer(五)