Hallo zusammen,
ich würde gerne die Sprache meiner App ändern wenn der user in seinem Handy (über setting) die Sprache sein Handy ändert.
hab diverse Beispiele im net angeschaut. Aber funktioniert bei mir irgendwie nicht
Das ist mein Code:
Code: strings.xml
<resources>
<string name="app_name">SaSiOutlet</string>
<string name="title_activity_login">login</string>
<string name="title_activity_register">register</string>
<string name="title_activity_search_item">SearchItem</string>
<string name="title_activity_favorite_item">FavoriteItem</string>
<string name="title_activity_shopping_item">ShoppingItem</string>
<string name="title_activity_my_side">MySide</string>
<string name="title_activity_base">BaseActivity</string>
<string name="shopping">Shopping</string>
<string name="langselection">selection</string>
</resources>
Alles anzeigen
Code: strings.xml (indem Ordner values-ira)
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="shopping">خريد</string>
<string name="title_activity_my_side">مشخصات</string>
<string name="langselection">انتخاب</string>
</resources>
Code: activity_shopping.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<!-- ===================TOP================= -->
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/relLayout">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:id="@+id/relLayoutTopBar"
android:layout_alignParentTop="true">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
</android.support.design.widget.AppBarLayout>
</RelativeLayout>
<!-- ===================Midlle================= -->
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/relLayoutMiddle"
android:layout_below="@+id/relLayoutTopBar"
android:layout_above="@+id/relLayoutBottomBar">
<Button
android:id="@+id/bHelp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:background="@android:color/transparent"
android:text="@string/shopping"
android:textSize="25dp"
android:textAllCaps="false"/>
<TextView
android:id="@+id/textView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/langselection"
android:textAppearance="?android:attr/textAppearanceMedium"
android:gravity="center"
android:paddingTop="25sp"
android:layout_below="@+id/bHelp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
</RelativeLayout>
<!-- ===================Bottom================= -->
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:id="@+id/relLayoutBottomBar"
android:layout_alignParentBottom="true">
<android.support.design.widget.BottomNavigationView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/bottom_NavView_bar"
android:background="@drawable/white_grey_border_top"
app:menu="@menu/bottom_navigation_menu">
</android.support.design.widget.BottomNavigationView>
</RelativeLayout>
</RelativeLayout>
</android.support.design.widget.CoordinatorLayout>
Alles anzeigen
und so sieht Translations Editor aus (siehe datei)
kann mir einer sagen wo mein Fehler ist?