RelativeLayout und margin/padding

  • Antworten:2
  • Bentwortet
Rainu
  • Forum-Beiträge: 42

18.05.2012, 10:53:27 via Website

Hallo,

ich habe folgendes mit folgendes layout zusammen gebastelt:
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="#556677"
6 >
7
8 <View
9 style="@style/BlockStyleWorld"
10 android:id="@+id/empty_topleft"
11 />
12
13 <LinearLayout
14 android:id="@+id/action_top"
15 android:layout_width="wrap_content"
16 android:layout_height="wrap_content"
17 android:layout_alignParentTop="true"
18 android:layout_toRightOf="@id/empty_topleft" >
19
20 <Button
21 style="@style/BlockStyleWorld"
22 android:text="^" />
23 </LinearLayout>
24
25 <View
26 android:id="@+id/empty_topright"
27 style="@style/BlockStyleWorld"
28 android:layout_alignParentTop="true"
29 android:layout_toRightOf="@id/action_top"
30 />
31
32
33 <LinearLayout
34 android:id="@+id/action_left"
35 android:layout_width="wrap_content"
36 android:layout_height="wrap_content"
37 android:layout_alignParentLeft="true"
38 android:layout_below="@id/empty_topleft" >
39
40 <Button
41 style="@style/BlockStyleWorld"
42 android:text="&lt;" />
43 </LinearLayout>
44
45 <View
46 android:id="@+id/empty_bottomleft"
47 style="@style/BlockStyleWorld"
48 android:layout_alignParentLeft="true"
49 android:layout_below="@id/action_left"
50 />
51
52 <LinearLayout
53 android:id="@+id/action_bottom"
54 android:layout_width="wrap_content"
55 android:layout_height="wrap_content"
56 android:layout_alignBottom="@id/empty_bottomleft"
57 android:layout_toRightOf="@id/empty_bottomleft" >
58
59 <Button
60 style="@style/BlockStyleWorld"
61 android:text="v" />
62 </LinearLayout>
63
64 <View
65 android:id="@+id/empty_bottomright"
66 style="@style/BlockStyleWorld"
67 android:layout_alignTop="@id/action_bottom"
68 android:layout_toRightOf="@id/action_bottom"
69 />
70
71 <LinearLayout
72 android:id="@+id/action_right"
73 android:layout_width="wrap_content"
74 android:layout_height="wrap_content"
75 android:layout_below="@id/empty_topright"
76 android:layout_above="@id/empty_bottomright"
77 android:layout_alignRight="@id/empty_topright"
78 >
79
80 <Button
81 style="@style/BlockStyleWorld"
82 android:text="&gt;" />
83 </LinearLayout>
84
85
86 <Button
87 android:id="@+id/playground"
88 style="@style/BlockStyleWorld"
89 android:layout_below="@id/action_top"
90 android:layout_above="@id/action_bottom"
91 android:layout_toRightOf="@id/action_left"
92 android:layout_toLeftOf="@id/action_right"
93
94 android:text="X" />
95</RelativeLayout>


1<?xml version="1.0" encoding="utf-8"?>
2<resources>
3 <style name="BlockStyleWorld">
4 <item name="android:layout_width">50dp</item>
5 <item name="android:layout_height">50dp</item>
6 <item name="android:textColor">#00FF00</item>
7 <item name="android:padding">0dp</item>
8 </style>
9</resources>

Nun sitzt ich hier schon Stunden und versuche den leeren Zwichenraum zu eliminieren. Ich hab schon versucht, padding = 0dp und margin = 0dp zu setzen -> ohne Erfolg. Ich habe keine Idee mehr, an was das noch liegen könnte. Ihr vielleicht?

Rainu

Antworten
Aeefire
  • Forum-Beiträge: 172

19.05.2012, 17:36:24 via Website

Wo genau tritt ein leerer Zwischenraum auf?

Aber das Problem kenne ich auch und ist glaub ich einfach so. Einen gewissen Zwischenraum zwischen einzelnen Elementen hat man wohl (leider) immer / überall und ist nicht zu verhindern meines Wissens nach.

Antworten
Rainu
  • Forum-Beiträge: 42

20.05.2012, 17:50:20 via Website

Anscheinend liegt das an dem "Bild" des Buttons. Die haben warscheinlich im Bild direkt schon entsprechende Zwichenräume. Sobald ich einen eigenen ImageButton mit eigenen Bild verwende, ist alles so wie es sein sollte :)

Antworten