Ich habe Probleme, mein Layout flexibel zu machen.Android Studio: Flexibles Layout (nur mit XML?)
Wenn ich wechseln Landschaft meine Tasten in meinem Grid statisch halten. Und auf der rechten Seite meines Gitternetzes ist viel Platz.
Ich mag mein Gridlayout zu zentrieren und die Größe meiner Tasten veränderbar zu jedem Gerät Größe.
Mein XML-Code hier (zeigt nur zwei Tasten):
<?xml version="1.0" encoding="utf-8"?>
<GridLayout 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="com.example.fdai3744.taschenrechnerneu.MainActivity">
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="0"
android:layout_row="0"
style="@style/ButtonStyle"
android:text="@string/cal_btn_clear" />
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="1"
android:layout_row="0"
style="@style/ButtonStyle"
android:text="@string/cal_btn_clear_entry" />
</GridLayout>
Ist es möglich, nur die Verwendung von XML oder soll ich auch Java verwenden?