- Forum-Beiträge: 94
19.03.2010, 18:58:40 via Website
19.03.2010 18:58:40 via Website
ich versuche gerade 4 RadioButtons zu einer RadioGroup zusammenzufassen und einigermaßen platzsparend anzuordnen. Leider ist für mich dieses Layouting bei Android völlig unverständlich...
1. Versuch:
Ergibt keine RadioGroup. Alle 4 RadioButtons lassen sich zusammen auswählen. s. Screenshot 01.
2 <TableLayout android:id="@+id/TableLayout01"
3 >
4 <TableRow android:id="@+id/TableRow01" android:layout_width="fill_parent" android:layout_height="wrap_content">
5
6 <RadioButton android:layout_height="wrap_content"
7 android:layout_width="fill_parent" android:id="@+id/radio_ice" android:text="ICE" android:layout_marginLeft="5sp"
8 android:layout_marginRight="5sp" android:layout_marginTop="5sp" android:layout_marginBottom="0sp" />
9
10 <RadioButton android:layout_height="wrap_content"
11 android:layout_width="fill_parent" android:id="@+id/radio_ic_ec" android:text="IC/EC" android:layout_marginLeft="5sp"
12 android:layout_marginRight="5sp" android:layout_marginTop="5sp" android:layout_marginBottom="0sp" />
13
14 </TableRow>
15 <TableRow android:id="@+id/TableRow02" android:layout_width="fill_parent" android:layout_height="wrap_content">
16
17 <RadioButton android:layout_height="wrap_content"
18 android:layout_width="fill_parent" android:id="@+id/radio_ir_d" android:text="IR/D" android:layout_marginLeft="5sp"
19 android:layout_marginRight="5sp" android:layout_marginTop="5sp" android:layout_marginBottom="0sp" />
20
21 <RadioButton android:layout_height="wrap_content"
22 android:layout_width="fill_parent" android:id="@+id/radio_re_rb" android:text="RE/RB" android:layout_marginLeft="5sp"
23 android:layout_marginRight="5sp" android:layout_marginTop="5sp" android:layout_marginBottom="0sp" />
24
25 </TableRow>
26 </TableLayout>
27 </RadioGroup>
2. Versuch:
Erzeugt auch keine RadioGroup, zerstört noch mehr. s. Screenshot 02
2
3 <RadioGroup android:id="@+id/traintype">
4
5 <TableRow android:id="@+id/TableRow01" android:layout_width="fill_parent" android:layout_height="wrap_content">
6
7 <RadioButton android:layout_height="wrap_content"
8 android:layout_width="fill_parent" android:id="@+id/radio_ice" android:text="ICE" android:layout_marginLeft="5sp"
9 android:layout_marginRight="5sp" android:layout_marginTop="5sp" android:layout_marginBottom="0sp" />
10
11 <RadioButton android:layout_height="wrap_content"
12 android:layout_width="fill_parent" android:id="@+id/radio_ic_ec" android:text="IC/EC" android:layout_marginLeft="5sp"
13 android:layout_marginRight="5sp" android:layout_marginTop="5sp" android:layout_marginBottom="0sp" />
14
15 </TableRow>
16
17 <TableRow android:id="@+id/TableRow02" android:layout_width="fill_parent" android:layout_height="wrap_content">
18
19 <RadioButton android:layout_height="wrap_content"
20 android:layout_width="fill_parent" android:id="@+id/radio_ir_d" android:text="IR/D" android:layout_marginLeft="5sp"
21 android:layout_marginRight="5sp" android:layout_marginTop="5sp" android:layout_marginBottom="0sp" />
22
23 <RadioButton android:layout_height="wrap_content"
24 android:layout_width="fill_parent" android:id="@+id/radio_re_rb" android:text="RE/RB" android:layout_marginLeft="5sp"
25 android:layout_marginRight="5sp" android:layout_marginTop="5sp" android:layout_marginBottom="0sp" />
26
27 </TableRow>
28
29 </RadioGroup>
30
31 </TableLayout>
3. Versuch:
erzeugt zwar eine RadioGroup, verschwendet aber unglaublich viel Platz. s. Screenshot 03
2
3 <RadioButton android:layout_height="wrap_content"
4 android:layout_width="fill_parent" android:id="@+id/radio_ice" android:text="ICE" android:layout_marginLeft="5sp"
5 android:layout_marginRight="5sp" android:layout_marginTop="5sp" android:layout_marginBottom="0sp" />
6
7 <RadioButton android:layout_height="wrap_content"
8 android:layout_width="fill_parent" android:id="@+id/radio_ic_ec" android:text="IC/EC" android:layout_marginLeft="5sp"
9 android:layout_marginRight="5sp" android:layout_marginTop="5sp" android:layout_marginBottom="0sp" />
10
11 <RadioButton android:layout_height="wrap_content"
12 android:layout_width="fill_parent" android:id="@+id/radio_ir_d" android:text="IR/D" android:layout_marginLeft="5sp"
13 android:layout_marginRight="5sp" android:layout_marginTop="5sp" android:layout_marginBottom="0sp" />
14
15 <RadioButton android:layout_height="wrap_content"
16 android:layout_width="fill_parent" android:id="@+id/radio_re_rb" android:text="RE/RB" android:layout_marginLeft="5sp"
17 android:layout_marginRight="5sp" android:layout_marginTop="5sp" android:layout_marginBottom="0sp" />
18
19 </RadioGroup>
Hat einer ne Idee, wie ich meine RadioButtons zu einer RadioGroup zusammenfassen und gleichzeitig platzsparend anordnen (am besten alle nebeneinander) kann?
Martin
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.