Tobias G
- Forum-Beiträge: 1
27.09.2011, 20:17:54 via Website
27.09.2011 20:17:54 via Website
Hallo,
ich habe ein recht eigenartiges Problem mit dem XML Layout. Und zwar bekomme ich es einfach nicht hin, dass ich wie in der Mail App (Gmail) so eine Statusleiste oben habe in dem sich links eine TextView und rechts ein Button befindet.
Komischerweise kann ich in das erste RelativeLayout (was diese Leiste darstellen soll) nur ein TextView + Button einfügen die ich weiter unten auch verwende (exakt gleich). Sobald ich IRGENDETWAS an den oberen ändere (was ja zwingend der Fall sein muss, sonst macht das ganze ja keinen Sinn) startet die App auf dem Emulator nicht mehr. Es wird sofort beim Start abgebrochen. Woran kann das liegen dass die App nicht funktioniert weil man z.B. den Namen eines Buttons ändert, obwohl dieser nirgends verwendet wird ?
Versucht habe ich es folgendermaßen:
ich habe ein recht eigenartiges Problem mit dem XML Layout. Und zwar bekomme ich es einfach nicht hin, dass ich wie in der Mail App (Gmail) so eine Statusleiste oben habe in dem sich links eine TextView und rechts ein Button befindet.
Komischerweise kann ich in das erste RelativeLayout (was diese Leiste darstellen soll) nur ein TextView + Button einfügen die ich weiter unten auch verwende (exakt gleich). Sobald ich IRGENDETWAS an den oberen ändere (was ja zwingend der Fall sein muss, sonst macht das ganze ja keinen Sinn) startet die App auf dem Emulator nicht mehr. Es wird sofort beim Start abgebrochen. Woran kann das liegen dass die App nicht funktioniert weil man z.B. den Namen eines Buttons ändert, obwohl dieser nirgends verwendet wird ?
Versucht habe ich es folgendermaßen:
1<?xml version="1.0" encoding="utf-8"?>
2<LinearLayout android:orientation="vertical" android:paddingLeft="2.0px" android:paddingRight="2.0px" android:layout_width="fill_parent" android:layout_height="wrap_content"
3 xmlns:android="http://schemas.android.com/apk/res/android">
4 <RelativeLayout android:paddingTop="5.0px" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="#1e90ff"
5 xmlns:android="http://schemas.android.com/apk/res/android">
6 <TextView android:id="@+id/kontakt" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/kontakt" />
7 <Button android:id="@+id/kontakt_finden" android:layout_width="wrap_content" android:layout_height="wrap_content" android:drawableLeft="@android:drawable/ic_menu_send" android:layout_alignParentRight="true" android:onClick="contactPicker" />
8 </RelativeLayout>
9 <TextView android:textSize="18.0dip" android:id="@+id/empfanger" android:background="#ff333333" android:paddingLeft="10.0px" android:paddingTop="3.0px" android:paddingBottom="3.0px" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Empfänger:" />
10 <LinearLayout android:orientation="vertical" android:paddingLeft="10.0px" android:paddingRight="10.0px" android:layout_width="fill_parent" android:layout_height="wrap_content"
11 xmlns:android="http://schemas.android.com/apk/res/android">
12 <RelativeLayout android:paddingTop="5.0px" android:layout_width="fill_parent" android:layout_height="wrap_content"
13 xmlns:android="http://schemas.android.com/apk/res/android">
14 <TextView android:textSize="27.0dip" android:id="@+id/kontakt" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/kontakt" />
15 <Button android:id="@+id/kontakt_finden" android:layout_width="wrap_content" android:layout_height="wrap_content" android:drawableLeft="@android:drawable/ic_menu_search" android:layout_weight="1.0" android:layout_alignParentRight="true" android:onClick="contactPicker" />
16 </RelativeLayout>
17 <EditText android:textSize="24.0dip" android:id="@+id/phone" android:paddingLeft="10.0px" android:paddingRight="10.0px" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="2.0" android:inputType="phone" />
18 </LinearLayout>
19 <RelativeLayout android:paddingTop="5.0px" android:paddingBottom="5.0px" android:layout_width="fill_parent" android:layout_height="wrap_content"
20 xmlns:android="http://schemas.android.com/apk/res/android">
21 <TextView android:textSize="18.0dip" android:id="@+id/nachricht" android:background="#ff333333" android:paddingLeft="10.0px" android:paddingTop="3.0px" android:paddingBottom="3.0px" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Nachricht:" />
22 </RelativeLayout>
23 <LinearLayout android:orientation="vertical" android:paddingLeft="10.0px" android:paddingRight="10.0px" android:layout_width="fill_parent" android:layout_height="fill_parent"
24 xmlns:android="http://schemas.android.com/apk/res/android">
25 <EditText android:textSize="24.0dip" android:gravity="top" android:id="@+id/text" android:layout_width="fill_parent" android:layout_height="wrap_content" android:lines="5" android:singleLine="false" android:layout_weight="5.0" android:inputType="textMultiLine" />
26 <Button android:textSize="24.0dip" android:id="@+id/senden" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/senden" android:drawableLeft="@android:drawable/ic_menu_send" android:layout_weight="3.0" android:onClick="senden" />
27 </LinearLayout>
28</LinearLayout>
2<LinearLayout android:orientation="vertical" android:paddingLeft="2.0px" android:paddingRight="2.0px" android:layout_width="fill_parent" android:layout_height="wrap_content"
3 xmlns:android="http://schemas.android.com/apk/res/android">
4 <RelativeLayout android:paddingTop="5.0px" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="#1e90ff"
5 xmlns:android="http://schemas.android.com/apk/res/android">
6 <TextView android:id="@+id/kontakt" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/kontakt" />
7 <Button android:id="@+id/kontakt_finden" android:layout_width="wrap_content" android:layout_height="wrap_content" android:drawableLeft="@android:drawable/ic_menu_send" android:layout_alignParentRight="true" android:onClick="contactPicker" />
8 </RelativeLayout>
9 <TextView android:textSize="18.0dip" android:id="@+id/empfanger" android:background="#ff333333" android:paddingLeft="10.0px" android:paddingTop="3.0px" android:paddingBottom="3.0px" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Empfänger:" />
10 <LinearLayout android:orientation="vertical" android:paddingLeft="10.0px" android:paddingRight="10.0px" android:layout_width="fill_parent" android:layout_height="wrap_content"
11 xmlns:android="http://schemas.android.com/apk/res/android">
12 <RelativeLayout android:paddingTop="5.0px" android:layout_width="fill_parent" android:layout_height="wrap_content"
13 xmlns:android="http://schemas.android.com/apk/res/android">
14 <TextView android:textSize="27.0dip" android:id="@+id/kontakt" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/kontakt" />
15 <Button android:id="@+id/kontakt_finden" android:layout_width="wrap_content" android:layout_height="wrap_content" android:drawableLeft="@android:drawable/ic_menu_search" android:layout_weight="1.0" android:layout_alignParentRight="true" android:onClick="contactPicker" />
16 </RelativeLayout>
17 <EditText android:textSize="24.0dip" android:id="@+id/phone" android:paddingLeft="10.0px" android:paddingRight="10.0px" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="2.0" android:inputType="phone" />
18 </LinearLayout>
19 <RelativeLayout android:paddingTop="5.0px" android:paddingBottom="5.0px" android:layout_width="fill_parent" android:layout_height="wrap_content"
20 xmlns:android="http://schemas.android.com/apk/res/android">
21 <TextView android:textSize="18.0dip" android:id="@+id/nachricht" android:background="#ff333333" android:paddingLeft="10.0px" android:paddingTop="3.0px" android:paddingBottom="3.0px" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Nachricht:" />
22 </RelativeLayout>
23 <LinearLayout android:orientation="vertical" android:paddingLeft="10.0px" android:paddingRight="10.0px" android:layout_width="fill_parent" android:layout_height="fill_parent"
24 xmlns:android="http://schemas.android.com/apk/res/android">
25 <EditText android:textSize="24.0dip" android:gravity="top" android:id="@+id/text" android:layout_width="fill_parent" android:layout_height="wrap_content" android:lines="5" android:singleLine="false" android:layout_weight="5.0" android:inputType="textMultiLine" />
26 <Button android:textSize="24.0dip" android:id="@+id/senden" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/senden" android:drawableLeft="@android:drawable/ic_menu_send" android:layout_weight="3.0" android:onClick="senden" />
27 </LinearLayout>
28</LinearLayout>
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.