Poo*_*bey 0 android android-layout android-linearlayout
我必须创建一个布局,其中有两个按钮。第二个按钮将在第一个按钮下方。请参阅此 XML,我已完成此操作,但我无法在按钮 1 下方设置按钮的位置。请帮助我得到这个 。
<?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" >
<LinearLayout
android:id="@+id/linearLayout2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="2dp"
android:orientation="horizontal"
android:weightSum="3" >
<TextView
android:id="@+id/ap"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_weight="1"
android:singleLine="true"
android:text="TEST" />
<TextView
android:id="@+id/st"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginTop="10dp"
android:layout_weight="1"
android:singleLine="true"
android:text="TEST" />
<TextView
android:id="@+id/tt"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginTop="10dp"
android:layout_weight="1"
android:singleLine="true"
android:text="TEST" />
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="36dp"
android:layout_marginLeft="5dp"
android:layout_marginTop="10dp"
android:layout_weight="1"
android:text="Button" />
</LinearLayout>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
试试你的按钮大小:
<?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" >
<LinearLayout
android:id="@+id/linearLayout2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="2dp"
android:orientation="horizontal"
android:weightSum="3" >
<TextView
android:id="@+id/ap"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_weight="1"
android:singleLine="true"
android:text="TEST" />
<TextView
android:id="@+id/st"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginTop="10dp"
android:layout_weight="1"
android:singleLine="true"
android:text="TEST" />
<TextView
android:id="@+id/tt"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginTop="10dp"
android:layout_weight="1"
android:singleLine="true"
android:text="TEST" />
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="36dp"
android:layout_marginLeft="5dp"
android:layout_marginTop="10dp"
android:layout_weight="1"
android:text="Button" />
</LinearLayout>
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_below="@+id/linearLayout2"
android:text="Button" />
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7972 次 |
| 最近记录: |