これは私のコードです。何が問題なのか教えていただけますか?
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/background_bf"
android:orientation="vertical" >
<ScrollView
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_margin="10dp"
android:layout_weight="1"
android:orientation="vertical" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:orientation="vertical" >
<TextView
android:layout_width="fill_parent"
android:layout_height="40dp"
android:gravity="center_vertical"
android:padding="10dp"
android:text="SELECT YOUR LANGUAGES"
android:textColor="#8E8D8D"
android:textStyle="bold" />
<TextView
android:id="@+id/langDutch"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:drawableLeft="@drawable/bg_settings_dutchon_hc_2x"
android:drawablePadding="10dp"
android:gravity="center_vertical"
android:onClick="onlanguageSelect"
android:padding="10dp"
android:text="Dutch"
android:textColor="#454C52" />
<TextView
android:id="@+id/langFlemish"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:drawableLeft="@drawable/bg_settings_dutchact_hc_2x"
android:drawablePadding="10dp"
android:gravity="center_vertical"
android:onClick="onlanguageSelect"
android:padding="10dp"
android:text="Flemish"
android:textColor="#454C52" />
<TextView
android:id="@+id/langFrench"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:drawableLeft="@drawable/bg_settings_franceon_hc_2x"
android:drawablePadding="10dp"
android:gravity="center_vertical"
android:onClick="onlanguageSelect"
android:padding="10dp"
android:text="French"
android:textColor="#454C52" />
</LinearLayout>
</ScrollView>
<TextView
android:id="@+id/settingscontinue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_margin="20dp"
android:background="@drawable/button_hc_bf_language_2x"
android:gravity="center"
android:text="CONTINUE"
android:textColor="@color/white"
android:textSize="16sp"
android:textStyle="bold" />
</LinearLayout>
これは活動中です:
public void onlanguageSelect(View v){
Log.v("Language Settings: ", " onlanguageSelect clicked.");
int id = v.getId();
String lang;
switch (id) {
case R.id.langDutch:
lang = "nl_NL";
break;
case R.id.langFlemish:
lang = "nl_BE";
break;
case R.id.langFrench:
lang = "fr";
break;
default:
lang = "nl";
break;
}
changeLocale(lang);
}
private void changeLocale(String localeString){
Locale locale = new Locale(localeString);
Locale.setDefault(locale);
Configuration config = new Configuration();
config.locale = locale;
getBaseContext().getResources().updateConfiguration(config, getBaseContext().getResources().getDisplayMetrics());
Log.v("Language Settings: ", "language changed successfully.");
}