2016-05-17 9 views
0

View Calendarスペイン語を使用しましたが、言語を変更する方法がわかりません。一部のプロパティは利用できません。カレンダービューの言語を変更するにはどうすればよいですか?

enter image description here

<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" 

    /> 

は、任意のプロパティまたはコードであり:

今、私はこれを持っていますか?

ありがとうございました。

答えて

2

この5月はあなたを助けます。

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); 
} 
} 

あなたはhere

+1

はありがとうござい例を見つけます!それは働いている!私が愛しているように私の人生を救った!!ああ、それは私に最初の文字大文字にしません – Laura

+0

config.localeとupdateConfigurationは廃止されました – ruselli

1

いいえ。 CalendarViewにはこのようなプロパティはありません。ビューで使用される言語は、デフォルトのデバイスの言語です。

アプリケーションを起動するときに、ロケールを動的に変更することができます。

例:

Locale locale = new Locale("en_US"); 
Locale.setDefault(locale); 
Configuration config = new Configuration(); 
config.locale = locale; 
context.getApplicationContext().getResources().updateConfiguration(config, null); 
関連する問題