我想创建一个具有两个LinearLayout(vertcal位置)的布局。Android百分比布局
首先linearLayout有80%从空间和另外20%(我用weightSum = 10)。
在第二个布局上,我有一个文本输入,当键盘出现时,屏幕尺寸缩小了,所以第二个线性布局太小了。
我希望我的secondLayout有最小的100dp和第一个布局,剩下的但我不知道如何实现这个。
谢谢!
我想创建一个具有两个LinearLayout(vertcal位置)的布局。Android百分比布局
首先linearLayout有80%从空间和另外20%(我用weightSum = 10)。
在第二个布局上,我有一个文本输入,当键盘出现时,屏幕尺寸缩小了,所以第二个线性布局太小了。
我希望我的secondLayout有最小的100dp和第一个布局,剩下的但我不知道如何实现这个。
谢谢!
重量被用于分发的剩余空的空间或带走空间,当总和大于所述的LinearLayout大。将你的宽度设置为0dip,它会起作用。
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:weightSum:"10" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="0dip"
android:layout_weight="8" >
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="0dip"
android:layout_weight="2">
</LinearLayout>
</LinearLayout>
使用支持库,您现在可以使用PercentRelativeLayout和PercentFrameLayout:https://juliengenoud.github.io/android-percent-support-lib-sample/ – 2015-08-03 16:46:14