android 开发之旅, should use @string resource警告
16lz
2021-01-23
在布局文件中,文本的设置使用如下写法时会有警告:Hardcoded string "BUTTON", should use @string resource [html] view plain copy
- <Button
- android:id="@+id/button1"
- android:layout_width="118dp"
- android:layout_height="wrap_content"
- android:text="button" />"
- <?xml version="1.0" encoding="utf-8"?>
- <resources>
- <string name="message">buttonstring>
- resources>
android:text="@string/message"
就行了。这样做可以做到一改全改,在支持多语言时也是很有用的。另外,颜色的设置也最好在color.xm中类似设置。 更多相关文章
- Android Layout的layout_height等属性为什么有时会不起作用?
- Android NDK编程中Application.mk和Android.mk写法
- Android ViewPager和PagerAdapter简单代码写法
- Android 自定义view的写法
- startService写法
- Android Timer计时器简单写法
- 【转】android编译系统的makefile文件Android.mk写法