Android 多语言实现
首先创建多语言资源:
?
各国语言缩写:http://www.loc.gov/standards/iso639-2/php/code_list.php,
国家和地区简写:http://www.iso.org/iso/en/prods-services/iso3166ma/02iso-3166-code-lists/list-en1.html
效果如图: ??
?
中文资源:
?
英文资源:?
<?xml version="1.0" encoding="utf-8"?>
? ? ? ? <activity android:name=".MainActivity"
? ? ? ? ? ? ? ? ? android:label="@string/app_name"
? ? ? ? ? ? ? ? ?android:configChanges="locale">
? ? ? ? ? ? <intent-filter>
? ? ? ? ? ? ? ? <action android:name="android.intent.action.MAIN" />
? ? ? ? ? ? ? ? <category android:name="android.intent.category.LAUNCHER" />
? ? ? ? ? ? </intent-filter>
? ? ? ? </activity>
?
? ? </application>
? ??<supports-screens
? ? ? ?android:smallScreens="true"
? ? ? ?android:normalScreens="true"
? ? ? ?android:largeScreens="true"
? ? ? ?android:anyDensity="true"/>
每一个Activity中都要加:?android:configChanges="locale"。
加?<supports-screens>是为了解决如下问题:
http://adrianvintu.com/blogengine/post/Force-Locale-on-Android.aspx
?
?