I have an app that supports different languages. However I have 1 layout file which I want to use no matter what the language.
This layout has a couple of buttons that open different activities but it needs to be in alphabetical order.
i.e. Car(eng) - Auto(de)
English version button 3 would open car activity, but German version button 1 would open car activity. How do I ensure this happens, or do I have to create different activities depending on language?
Layout File:
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="72dp"
android:orientation="horizontal" >
<Button
android:id="@+id/btnButton1"
android:layout_width="72dp"
android:layout_height="72dp"
android:layout_marginTop="20dp"
android:layout_marginLeft="25dp"
android:text="1" />
<Button
android:id="@+id/btnButton2"
android:layout_width="72dp"
android:layout_height="72dp"
android:layout_toRightOf="@+id/btnButton1"
android:layout_alignBottom="@+id/btnButton1"
android:layout_marginLeft="5dp"
android:text="2"/>
<Button
android:id="@+id/btnButton3"
android:layout_width="72dp"
android:layout_height="72dp"
android:layout_toRightOf="@+id/btnButton2"
android:layout_alignBottom="@+id/btnButton2"
android:layout_marginLeft="5dp"
android:text="3"/>
</RelativeLayout>
Class that has buttons:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Locale.getDefault();
setContentView(R.layout.activity_animal_choice);
btnButton1 = (Button) findViewById(R.id.btnButton1);
btnButton1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(Menu.this, Car.class);
startActivity(intent);
}
});
It would be good to see if this is possible, if not it will probably be quicker and easier to create different apk's per language