首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > Android >

[Android]"@string/hello"跟"你好"的区别

2012-08-07 
[Android]@string/hello和你好的区别?TextView ?? ? android:layout_widthfill_parent?? ? androi

[Android]"@string/hello"和"你好"的区别

?

<TextView ?

? ? android:layout_width="fill_parent"?

? ? android:layout_height="wrap_content"?

? ? android:text="@string/hello"

? ? />

?

<TextView ?

? ? android:layout_width="fill_parent"?

? ? android:layout_height="wrap_content"?

? ? android:text="hello"

? ? />

?

在strings.xml配置string的好处:

1.以后修改方便,类似于C/C++中的宏定义

2.为了国际化

3.节省内存,例如:"hello"被用了10000次,就占用了50000个字节,而使用"@string/hello"则会占用5个,其它地方用到时,就直接取得引用。

热点排行