Michael H
- Forum-Beiträge: 127
26.06.2012, 11:24:47 via Website
26.06.2012 11:24:47 via Website
Habe ein Layoutproblem...
Möchte gerne jeweils pro Zeile 2 Bilder nebeneinander anzeigen, welche auf die richtige Grösse skaliert werden müssen. Das ganze funktioniert mit untenstehendem XML-Code schon ganz gut. Jedoch habe ich in der Höhe immer viel zu viel Abstand zum oberen/unteren Rand. D.H. ich will das die Bilder 50% in der Breite und wrap_content (so hoch wie das Bild ist) in der Höhe einnehmen. Liegt sehrwahrscheindlich am layout_weight, aber habe noch keine andere Lösung gefunden.
Hat vielleicht jemand ein Trick?
Vielen Dank
Michi
Möchte gerne jeweils pro Zeile 2 Bilder nebeneinander anzeigen, welche auf die richtige Grösse skaliert werden müssen. Das ganze funktioniert mit untenstehendem XML-Code schon ganz gut. Jedoch habe ich in der Höhe immer viel zu viel Abstand zum oberen/unteren Rand. D.H. ich will das die Bilder 50% in der Breite und wrap_content (so hoch wie das Bild ist) in der Höhe einnehmen. Liegt sehrwahrscheindlich am layout_weight, aber habe noch keine andere Lösung gefunden.
Hat vielleicht jemand ein Trick?
Vielen Dank
Michi
1<?xml version="1.0" encoding="utf-8"?>
2<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 android:layout_width="fill_parent"
4 android:layout_height="fill_parent"
5 android:background="@color/background"
6 android:padding="10dip" >
7
8 <ImageView
9 android:layout_width="wrap_content"
10 android:layout_height="wrap_content"
11 android:layout_centerInParent="true"
12 android:src="@drawable/logo_background_trans" />
13
14 <ScrollView
15 android:layout_width="fill_parent"
16 android:layout_height="wrap_content"
17 android:layout_alignParentTop="true" >
18
19 <TableLayout
20 android:layout_width="fill_parent"
21 android:layout_height="wrap_content"
22 android:orientation="horizontal" >
23
24 <TableRow
25 android:weightSum="1.0">
26
27 <ImageView
28 android:layout_width="0px"
29 android:layout_height="wrap_content"
30 android:src="@drawable/find"
31 android:layout_weight="0.5" />
32
33 <ImageView
34 android:layout_width="0px"
35 android:layout_height="wrap_content"
36 android:src="@drawable/find"
37 android:layout_weight="0.5" />
38
39 </TableRow>
40
41 <TableRow
42 android:weightSum="1.0">
43
44 <ImageView
45 android:layout_width="0px"
46 android:layout_height="wrap_content"
47 android:src="@drawable/find"
48 android:layout_weight="0.5" />
49
50 <ImageView
51 android:layout_width="0px"
52 android:layout_height="wrap_content"
53 android:src="@drawable/find"
54 android:layout_weight="0.5" />
55
56 </TableRow>
57
58 </TableLayout>
59
60 </ScrollView>
61
62</RelativeLayout>
2<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 android:layout_width="fill_parent"
4 android:layout_height="fill_parent"
5 android:background="@color/background"
6 android:padding="10dip" >
7
8 <ImageView
9 android:layout_width="wrap_content"
10 android:layout_height="wrap_content"
11 android:layout_centerInParent="true"
12 android:src="@drawable/logo_background_trans" />
13
14 <ScrollView
15 android:layout_width="fill_parent"
16 android:layout_height="wrap_content"
17 android:layout_alignParentTop="true" >
18
19 <TableLayout
20 android:layout_width="fill_parent"
21 android:layout_height="wrap_content"
22 android:orientation="horizontal" >
23
24 <TableRow
25 android:weightSum="1.0">
26
27 <ImageView
28 android:layout_width="0px"
29 android:layout_height="wrap_content"
30 android:src="@drawable/find"
31 android:layout_weight="0.5" />
32
33 <ImageView
34 android:layout_width="0px"
35 android:layout_height="wrap_content"
36 android:src="@drawable/find"
37 android:layout_weight="0.5" />
38
39 </TableRow>
40
41 <TableRow
42 android:weightSum="1.0">
43
44 <ImageView
45 android:layout_width="0px"
46 android:layout_height="wrap_content"
47 android:src="@drawable/find"
48 android:layout_weight="0.5" />
49
50 <ImageView
51 android:layout_width="0px"
52 android:layout_height="wrap_content"
53 android:src="@drawable/find"
54 android:layout_weight="0.5" />
55
56 </TableRow>
57
58 </TableLayout>
59
60 </ScrollView>
61
62</RelativeLayout>
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.