2017-08-17 49 views
0
<resources> 
    <string name="otpValidationMessage">Please enter the One Time Password\n and validate your phone number</string> 

    <string name="firstName">First Name</string> 
    <string name="lastName">Last Name</string> 
    <string name="mobileNumber">Mobile Number</string> 
    <string name="otpPassword">One Time Password</string> 
    <string name="code">Code</string> 
    <string name="resendOTp">Resend OTP</string> 

我已更改手机语言,但在应用程序中看不到语言更改。我在String文件中拥有所有文本,但仍然没有更改。手机中的语言更改不会影响应用程序 - Android

+0

重新启动活动 –

+0

检查您的应用是否有固定的文字字体和大小 – Reena

+0

您是否可以通过屏幕查看字符串文件的结构? –

回答

1

在做的onCreate这改变你的语言阿拉比

myLocale = new Locale("ar");//"en" if you want english 
Locale.setDefault(myLocale); 
android.content.res.Configuration config = new android.content.res.Configuration(); 
config.locale = myLocale; 
getBaseContext().getResources().updateConfiguration(config, getBaseContext().getResources().getDisplayMetrics()); 
your_text_view.setText(R.string.Name); 

和字符串创建为RES /值-AR/strings.xml中

<string name="Name">Arabi</string> 

和字符串创建为资源/values-en/strings.xml

<string name="Name">English</string> 

如果您有任何疑问,意见下来

+0

但是创建一个文件所有语言都很难!有没有一种方式,它动态地将字符串更改为系统语言@GT – Racer

+0

是的课程其他手机如何获得翻译后的语言我们不得不提及它 – g7pro

+0

在此代码中,texview具有arabi,如果ar被设置,则英语如果en是分别设置为mylocale – g7pro

相关问题