Overlook the localization of resource in compiling

When we compile android project, it is recommend that the resoureces should be localized, for instance:android

<View android:id="@+id/my_text"this

    android:layout_width="wrap_content"rest

    android:lahyout_height="wrap_content"xml

    android:text="Hello Text View"/>string


the android:text should not be directly assigned with "Hello Text View", instead, we should first define string item in strings.xml, and use id in TextView, as below:it

In strings.xmlio

<string name="hello">Hello Text View</string>sed

In layout.xmllayout

<View android:id="@+id/my_text"di

    android:layout_width="wrap_content"

    android:lahyout_height="wrap_content"

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


However, when we compile projects from other individuals, we can not modify every reference of local resource, so we should try to ingore this restriction.


Since we know 'aapt' tool can be used to package resources in android, there is a argument used for localization of resources.


aapt -pakcage -z...

If you wan't ignore localization, please DON'T add -z as argument.

相關文章
相關標籤/搜索