我想让按钮从屏幕宽度始终填充 50%
,因为当我水平或垂直旋转设备时,按钮总是填充 50%
从宽度。
最佳答案
这应该可以通过使用 weightSum 和 layout_weight 来实现:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:orientation="horizontal"
android:weightSum="1.0">
<Button
android:id="@+id/textbox3"
android:layout_height="wrap_content"
android:layout_weight=".5"
android:layout_width="0dip"
android:textSize="12sp" />
</LinearLayout>
关于android - 如何使按钮从android中的屏幕宽度填充50%?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4588551/