本地化应用名称

And*_*rew 2 string android localization

我想本地化(values-ru)字符串值:textview和app_name.应用程序仅本地化textview("Приветмир"),但app_name仍然相同("本地化").app_name本地化有什么问题?

Manifest中的应用程序标签名称和活动标签名称是指相应的字符串值.

表现:

 <application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name="com.example.local.MainActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>
Run Code Online (Sandbox Code Playgroud)

字符串res/values-ru:

<resources>
<string name="hello_world">?????? ???</string>
<string name="app_name">???????????</string>
</resources>
Run Code Online (Sandbox Code Playgroud)

Java的:

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    String languageToLoad  = "ru";
    Locale locale = new Locale(languageToLoad); 
    Locale.setDefault(locale);
    Configuration config = new Configuration();
    config.locale = locale;
    getBaseContext().getResources().updateConfiguration(config, 
    getBaseContext().getResources().getDisplayMetrics());

    setContentView(R.layout.activity_main);
}
Run Code Online (Sandbox Code Playgroud)

sky*_*eek 7

这将在本地而不是移动设备上更改应用程序的区域设置.并且Manifest根据设备区域设置选择应用程序名称的值,而不是应用程序区域设置.因此,您需要根据移动设备的设置进行设置.