我总是在Android文档中读到这个有趣的重量值。现在我想第一次试一试,但它根本不起作用。
正如我从文档中了解到的那样,这个布局:
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
android:text="Register"
android:id="@+id/register"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="10dip"
weight="1" />
android:text="Not this time"
android:id="@+id/cancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="10dip"
weight="1" />
应该创建两个水平对齐并平均共享空间的按钮。问题是这两个按钮没有长出来填补空间。
我希望按钮能长出来,填满整条线。如果两个按钮都设置为匹配父按钮,则只显示第一个按钮并填充整行。
Android中的线性布局和权重