我们如果把子控件的width设为0dp的话
那么我们可以通过设置
android:layout_weight=“n”的方式来设置控件占布局的比例
另外 我们也可以一个是使用weight
一个不适用
这样 另外一个 比如我们这里的按钮 还是保留原来的宽度。这种写法非常适合
android:orientation="horizontal" android:layout_width="match_parent"
android:layout_height="match_parent">
android:id="@+id/button1"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:text="1" />
android:id="@+id/button2"
android:layout_width="0dp"
android:layout_weight="2"
android:layout_height="wrap_content"
android:text="2" />
android:id="@+id/button3"