How to solve Error: This attribute must be localized. 两种方式
2012-07-31 22:16
477 查看
引用:http://stackoverflow.com/questions/8446337/how-to-solve-error-this-attribute-must-be-localized-at-text-with-value-top
down vote | Best practice for Android apps is to define all of the non-dynamic content in resource files. This lets you define different resource files for different languages, for example. Normally, this is just a recommendation and the Android SDK doesn't complain if you hard-code values in your layout xml. The Android source build system, however, requires that all strings be defined in a "values" resource. This is probably intended to protect system builders from accidentally leaving content in a system image that won't display in the user's chosen language. What you need to do is move those string values out of the layout and define them in res/values/instead. The usual place for string values is in res/values/strings.xml, but the actual file can be named anything you like as long as it's in that directory. For example, in res/values/string.xml: <stringname="topLeftContent">TOP_LEFT</string> And in your main.xmllayout, refer to the content by name: android:text="@string/topLeftContent" For more details on the how and why of this, see Google's documentation on Localization in Android.
| ||
Was this post useful to you? |
up vote0down vote | You can useLOCAL_MODULE_TAGS := tests in the Android.mk to omits the localization check. Another way is to disable localization check in build system. Comment the line 81 in build/core/package.mk #LOCAL_AAPT_FLAGS := $(LOCAL_AAPT_FLAGS) -z |
相关文章推荐
- 忽略Android资源编译错误 Error: this attribute must be localized
- This attribute must be localized.错误解决方式
- This attribute must be localized.错误解决方式
- Error: This attribute must be localized. 解决方法
- 如何忽略Android资源编译错误 Error: this attribute must be localized.
- This attribute must be localized.错误解决方式
- This attribute must be localized.错误解决方式
- Error: This attribute must be localized. 解决方法
- This attribute must be localized.错误解决方式
- 如何忽略Android资源编译错误 Error: this attribute must be localized.
- Android Error: This attribute must be localized.
- This attribute must be localized.错误解决方式
- Error: This attribute must be localized. 解决方法
- 如何忽略Android资源编译错误 Error: this attribute must be localized.
- This attribute must be localized
- This attribute must be localized”
- Android studio应用导入源码错误This attribute must be localized
- cocos2d 安装出现Error: This script must be run as root in order to copy templates to /Library/Applicatio
- This attribute must be localized错误
- how to solve Error cannot add duplicate collection entry of type add with unique key attribute 'valu