2017-09-27 16 views
0

アンドロイドスタジオのXMLファイルに問題があります。私は非常に新しく、テキストをデザインしたいのですが、テキストの下に2つのボタンがありますが、唯一の最後のボタンは、デバイスに表示される最後の(0,0)の位置に配置 ここで終わりに私のコードアンドロイドスタジオでコンテンツランタイムエラーが発生しました

<?xml version="1.0" encoding="utf-8"?> 
<android.support.constraint.ConstraintLayout 
xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:app="http://schemas.android.com/apk/res-auto" 
xmlns:tools="http://schemas.android.com/tools" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
tools:context="com.example.tabarek.mysecondapplication.MainActivity"> 

<TextView 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:text="Information!" 
    android:id="@+id/hello" 
    /> 

<Button 
    android:id="@+id/button" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:onClick="SayHi" 
    android:text="About Me" 
    android:layout_below="@+id/hello" 
    /> 
<Button 
    android:id="@+id/button2" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:onClick="SayHi" 
    android:text="My Email" 
    android:layout_below="@+id/button" 
    /> 
    </android.support.constraint.ConstraintLayout> 

だ、 結果は次のように表示されます enter image description here

あなたは私を助けることができます、 お願いします?

答えて

0

は、それが動作LinearLayout

<LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:orientation="vertical"> 

    <TextView 
     android:id="@+id/hello" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:text="Information!" /> 

    <Button 
     android:id="@+id/button" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:onClick="SayHi" 
     android:text="About Me" /> 

    <Button 
     android:id="@+id/button2" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:onClick="SayHi" 
     android:text="My Email" /> 
</LinearLayout> 
+0

この使用してみてください!!!!どうもありがとう –

関連する問題