2017-09-13 15 views
-9

私はアンドロイドでデビューだと私は、水平および垂直のLinearLayoutを使用しようとしましたが、それはない私はこのようなインターフェイスを取得したいが、私は私のLinearLayoutインタフェースこのインターフェースはどのように入手できますか?

enter image description here

を置くことができませんでした仕事

<LinearLayout 
       android:orientation="horizontal" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:gravity="center_horizontal" 
       android:layout_alignParentTop="true" 
       android:layout_alignParentLeft="true" 
       android:layout_alignParentStart="true"><TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:textSize="22sp" 
        android:layout_marginRight="10dp" 
        android:layout_marginEnd="10dp" 
        android:id="@+id/txt1" 
        android:text="AAAAAAAA"/><Button 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="BE" 
        android:id="@+id/button1"/></LinearLayout> 
     <LinearLayout 
        android:orientation="vertical" 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        android:layout_alignParentTop="true" 
        android:layout_alignParentLeft="true" 
        android:layout_alignParentStart="true" 
        android:gravity="bottom"> 
    <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:textSize="22sp" 
        android:layout_marginRight="10dp" 
        android:layout_marginEnd="10dp" 
        android:id="@+id/txt2" 
        android:text="RRRRRRR"/><LinearLayout 
        android:orientation="horizontal" 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        android:layout_alignParentTop="true" 
        android:layout_alignParentLeft="true" 
        android:layout_alignParentStart="true"> 
     <TextView android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:textSize="22sp" 
        android:layout_marginRight="10dp" 
        android:layout_marginEnd="10dp" 
        android:id="@+id/txt3" 
        android:text="JJJJJJJJJJ"/> 
     <Button android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="GO" 
        android:id="@+id/button2"/> 
     </LinearLayout> 
     <Button android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="Start" 
        android:id="@+id/button3"/> 
     </LinearLayout> 

このコードを修正するのを手伝ってもらえますか?

+1

この使用を試すことができます。 – xvlcw

+0

異なるレイアウトを練習してデザインし、そのプロパティを使用して変更を確認する必要があります。初心者には時間がかかりますが、私たちはすべて数年前の初心者でした。 – Kunu

答えて

0

このコードを試してください。これが役立ちます。

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:gravity="center_horizontal" 
    android:orientation="vertical"> 

<LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="0dp" 
    android:layout_weight="0.7" 
    android:gravity="center_horizontal"> 

    <TextView 
     android:id="@+id/txt1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_marginEnd="10dp" 
     android:layout_marginRight="10dp" 
     android:text="AAAAAAAA" 
     android:textSize="22sp" /> 

    <Button 
     android:id="@+id/button1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="BE" /> 
</LinearLayout> 


<LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="0dp" 
    android:layout_weight="0.2" 
    android:gravity="center_horizontal" 
    android:orientation="vertical"> 

    <TextView 
     android:id="@+id/txt2" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_marginEnd="10dp" 
     android:layout_marginRight="10dp" 
     android:layout_gravity="center_horizontal" 
     android:text="RRRRRRR" 
     android:textSize="22sp" /> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:gravity="center_horizontal" 
     android:orientation="horizontal"> 

     <TextView 
      android:id="@+id/txt3" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_marginEnd="10dp" 
      android:layout_marginRight="10dp" 
      android:text="JJJJJJJJJJ" 
      android:textSize="22sp" /> 

     <Button 
      android:id="@+id/button2" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="GO" /> 

    </LinearLayout> 

    <Button 
     android:id="@+id/button3" 
     android:layout_width="wrap_content" 
     android:layout_height="0dp" 
     android:layout_weight="0.2" 
     android:layout_gravity="center_horizontal" 
     android:text="Start" /> 
</LinearLayout> 

0

あなたは、私が最初のインターフェイスを持つ1人の仲間は、プログラミング言語構造であるので、あなたがUIとしてのインタフェースを参照するべきだと思いますRelativeLayout

<?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="match_parent" 
    android:orientation="vertical"> 


    <TextView 
     android:id="@+id/txt1" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignParentTop="true" 
     android:layout_marginEnd="10dp" 
     android:layout_marginRight="10dp" 
     android:gravity="center" 
     android:text="AAAAAAAA" 
     android:textSize="22sp" /> 

    <TextView 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_above="@+id/myl1" 
     android:gravity="center" 
     android:text="123465" /> 

    <LinearLayout 
     android:id="@id/myl1" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_above="@+id/button3" 
     android:orientation="horizontal"> 

     <TextView 
      android:layout_width="0dp" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:gravity="center" 
      android:text="123465" /> 

     <Button 
      android:layout_width="0dp" 
      android:layout_height="wrap_content" 
      android:layout_alignParentBottom="true" 
      android:layout_weight="1" 
      android:text="Start" /> 

    </LinearLayout> 

    <Button 
     android:id="@+id/button3" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignParentBottom="true" 
     android:text="Start" /> 
</RelativeLayout> 
関連する問題