首页 > 移动平台 > 详细

Android字符串在strings.xml文件的定义和使用

时间:2017-11-04 15:29:56      阅读:291      评论:0      收藏:0      [点我收藏+]

  路径:res/values/strings.xml

  定义示例:

1 <resources>
2     <string name="app_name">SzLib</string>
3     <string name="address">广东省深圳市福田区福中一路2001号</string>
4     <string name="website">https://www.szlib.org.cn</string>
5     <string name="email">reference@szlib.org.cn</string>
6     <string name="phone_number">0755-82841212</string>
7 </resources>

  引用示例:

 1 <?xml version="1.0" encoding="utf-8"?>
 2 <LinearLayout
 3     xmlns:android="http://schemas.android.com/apk/res/android"
 4     xmlns:tools="http://schemas.android.com/tools"
 5     android:layout_width="match_parent"
 6     android:layout_height="match_parent"
 7     tools:context="com.example.administrator.szlib.MainActivity"
 8     android:orientation="vertical">
 9 
10 
11   <TextView
12         android:layout_width="wrap_content"
13         android:layout_height="wrap_content"
14         android:text="@string/phone_number"/>
15 
16 
17 </LinearLayout>

 

Android字符串资源及其格式化

Android中的字符串

 

Android字符串在strings.xml文件的定义和使用

原文:http://www.cnblogs.com/infocodez/p/7783224.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!