效果图如上,根据不同权重排列三个控件
代码如下:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<Button
android:id="@+id/btn_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="按钮1"
android:textColor="#000000"
android:layout_weight="1"
/>
<Button
android:id="@+id/btn_2"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="按钮2"
android:textColr="#000000"
android:layout_weight="3"
/>
<Button
android:id="@+id/btn_3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="按钮3"
android:textColor="#000000"
android:layout_weight="6"
/>
</LinearLayout>