2017-03-16 29 views
-5

Ich habe eine einfache App mit einem relativen Layout mit drei Schaltflächen, aber es stürzt weiter ab, wenn ich es im Emulator starte.Meine App stürzt weiter

mein Layout XML ist unten gezeigt:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content"> 

    <Button 
     android:id="@+id/one" 
     android:layout_alignParentLeft="true" 
     android:layout_alignParentTop="true"></Button> 

    <Button 
     android:id="@+id/two" 
     android:layout_alignParentTop="true" 
     android:layout_toRightOf="@id/one"></Button> 

    <Button 
     android:id="@+id/three" 
     android:layout_alignParentTop="true" 
     android:layout_toRightOf="@id/two"></Button> 
</RelativeLayout> 
+5

Es sei denn, Sie fügen Ihre Crash-Nachricht, wir können Ihnen nicht helfen –

+3

fügen Sie bitte Ihre Logcat und überprüfen Sie Ihre Manifest – Jehad

+0

in der Emu lator sagt "Appname hält weiter an" – userr

Antwort

0

Satz Breite, Höhe auf Taste

 <?xml version="1.0" encoding="utf-8"?> 
     <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content"> 

     <Button 
      android:id="@+id/one" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignParentLeft="true" 
      android:layout_alignParentTop="true"/> 

     <Button 
      android:id="@+id/two" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignParentTop="true" 
      android:layout_toRightOf="@id/one" /> 

     <Button 
      android:id="@+id/three" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignParentTop="true" 
      android:layout_toRightOf="@id/two" /> 
    </RelativeLayout> 
+0

vielen Dank es funktioniert – userr

+0

Gern geschehen :) pls accept antwort – user2025187

0

android hinzufügen: layout_width und android: layout_height für die Tasten

Verwandte Themen