Steffen H.
- Forum-Beiträge: 6
13.07.2011, 22:41:36 via Website
13.07.2011 22:41:36 via Website
Hallo Leute,
Ich habe den Bildschirm grob in 2 Hälften unterteilt. Die linke Hälfte ist dabei ca. 20% groß und die rechte 80%. Mit Linearlayouts alles soweit gut, doch jetzt habe ich in die linke Hälfte ein relative layout mit darin ausgerichteten TextViews verbaut. Die linke Hälfte ist jetzt viel zu groß und sollte eigentlich nur in etwa so groß sein wie der Text Platz beansprucht.
Hier mal ein Bild.
und hier meine xml:
Habe ich hier irgendein wichitges Atribut vergessen oder die TextViews falsch ausgerichtet? Ich habe schon alle möglichen Kombination der weight werte ausprobiert, doch ich brauch schon unmenschlich große zahlen um die beiden Hälften nur annähernd gleich groß zu bekommen, geschweigen denn die linke kleiner ;) Hoffe ihr könnt mir helfen.
mfg Steffen
Ich habe den Bildschirm grob in 2 Hälften unterteilt. Die linke Hälfte ist dabei ca. 20% groß und die rechte 80%. Mit Linearlayouts alles soweit gut, doch jetzt habe ich in die linke Hälfte ein relative layout mit darin ausgerichteten TextViews verbaut. Die linke Hälfte ist jetzt viel zu groß und sollte eigentlich nur in etwa so groß sein wie der Text Platz beansprucht.
Hier mal ein Bild.
und hier meine xml:
1<?xml version="1.0" encoding="utf-8"?>
2<LinearLayout
3 xmlns:android="http://schemas.android.com/apk/res/android"
4 android:layout_width="match_parent"
5 android:layout_height="match_parent">
6 <LinearLayout android:layout_width="fill_parent" android:id="@+id/linearLayout1" android:layout_height="fill_parent" android:baselineAligned="false" android:orientation="horizontal" android:padding="0dp">
7 <LinearLayout android:id="@+id/relativeLayout1" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_weight="1" android:background="#ccc" android:orientation="vertical">
8 <RelativeLayout android:id="@+id/Rl1" android:gravity="bottom" android:layout_height="match_parent" android:layout_width="match_parent" android:layout_weight="1">
9 <TextView android:text="Text" android:id="@+id/Stunde1" android:layout_alignParentLeft="true" android:textColor="#000000" android:layout_width="wrap_content" android:gravity="center" android:layout_height="fill_parent" android:layout_marginRight="10dp"></TextView>
10 <TextView android:text="Text" android:id="@+id/textView5" android:textColor="#000000" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_alignParentTop="true" android:layout_toRightOf="@+id/Stunde1" android:layout_width="wrap_content"></TextView>
11 <TextView android:layout_width="wrap_content" android:text="Text" android:id="@+id/textView6" android:textColor="#000000" android:layout_alignParentBottom="true" android:layout_alignParentRight="true" android:layout_height="wrap_content" android:layout_toRightOf="@+id/Stunde1"></TextView>
12 </RelativeLayout>
13 </LinearLayout>
14 <LinearLayout android:orientation="vertical" android:layout_width="wrap_content" android:id="@+id/relativeLayout1" android:layout_height="match_parent" android:layout_weight="1" android:layout_margin="0dp" android:background="#eee">
15 <TextView android:text="Linear Layout 1" android:id="@+id/textView3" android:textColor="#000000" android:layout_width="match_parent" android:layout_height="fill_parent" android:layout_weight="1" android:gravity="center" android:background="#bbb"></TextView>
16 </LinearLayout>
17 </LinearLayout>
18</LinearLayout>
2<LinearLayout
3 xmlns:android="http://schemas.android.com/apk/res/android"
4 android:layout_width="match_parent"
5 android:layout_height="match_parent">
6 <LinearLayout android:layout_width="fill_parent" android:id="@+id/linearLayout1" android:layout_height="fill_parent" android:baselineAligned="false" android:orientation="horizontal" android:padding="0dp">
7 <LinearLayout android:id="@+id/relativeLayout1" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_weight="1" android:background="#ccc" android:orientation="vertical">
8 <RelativeLayout android:id="@+id/Rl1" android:gravity="bottom" android:layout_height="match_parent" android:layout_width="match_parent" android:layout_weight="1">
9 <TextView android:text="Text" android:id="@+id/Stunde1" android:layout_alignParentLeft="true" android:textColor="#000000" android:layout_width="wrap_content" android:gravity="center" android:layout_height="fill_parent" android:layout_marginRight="10dp"></TextView>
10 <TextView android:text="Text" android:id="@+id/textView5" android:textColor="#000000" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_alignParentTop="true" android:layout_toRightOf="@+id/Stunde1" android:layout_width="wrap_content"></TextView>
11 <TextView android:layout_width="wrap_content" android:text="Text" android:id="@+id/textView6" android:textColor="#000000" android:layout_alignParentBottom="true" android:layout_alignParentRight="true" android:layout_height="wrap_content" android:layout_toRightOf="@+id/Stunde1"></TextView>
12 </RelativeLayout>
13 </LinearLayout>
14 <LinearLayout android:orientation="vertical" android:layout_width="wrap_content" android:id="@+id/relativeLayout1" android:layout_height="match_parent" android:layout_weight="1" android:layout_margin="0dp" android:background="#eee">
15 <TextView android:text="Linear Layout 1" android:id="@+id/textView3" android:textColor="#000000" android:layout_width="match_parent" android:layout_height="fill_parent" android:layout_weight="1" android:gravity="center" android:background="#bbb"></TextView>
16 </LinearLayout>
17 </LinearLayout>
18</LinearLayout>
Habe ich hier irgendein wichitges Atribut vergessen oder die TextViews falsch ausgerichtet? Ich habe schon alle möglichen Kombination der weight werte ausprobiert, doch ich brauch schon unmenschlich große zahlen um die beiden Hälften nur annähernd gleich groß zu bekommen, geschweigen denn die linke kleiner ;) Hoffe ihr könnt mir helfen.
mfg Steffen
Empfohlener redaktioneller Inhalt
Mit Deiner Zustimmung wird hier ein externer Inhalt geladen.
Mit Klick auf den oben stehenden Button erklärst Du Dich damit einverstanden, dass Dir externe Inhalte angezeigt werden dürfen. Dabei können personenbezogene Daten an Drittanbieter übermittelt werden. Mehr Infos dazu findest Du in unserer Datenschutzerklärung.