如何更改日历视图的语言?

Lau*_*ura 5 android

我使用了查看日历西班牙语,但我不确定如何更改语言,有些属性在任何地方都不可用。

现在我有这个:

在此处输入图片说明

<CalendarView
android:id="@+id/calendari"
android:layout_margin="10dp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:weekNumberColor="@color/botoCalendari"
    android:focusedMonthDateColor="#d91f1f"
    android:weekSeparatorLineColor="#1fd928"
    android:selectedWeekBackgroundColor="#1fd9d6"
    android:unfocusedMonthDateColor="#d91fd9"

    />
Run Code Online (Sandbox Code Playgroud)

是否有任何财产或代码?

非常感谢。

Sat*_*r J 4

这可能对你有帮助。

import android.app.Activity;
import android.content.res.Configuration;
import android.os.Bundle;

public class Main extends Activity {
 /** Called when the activity is first created. */
 @Override
  public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);

String languageToLoad  = "fa"; // your language
Locale locale = new Locale(languageToLoad); 
Locale.setDefault(locale);
Configuration config = new Configuration();
config.locale = locale;
getBaseContext().getResources().updateConfiguration(config, 
  getBaseContext().getResources().getDisplayMetrics());
this.setContentView(R.layout.main);
}
}
Run Code Online (Sandbox Code Playgroud)

你在这里找到例子

  • 谢谢你!!它已经起作用了!因为我爱你救了我的命!!哦,但这并不会让我的第一个字母大写 (2认同)