Cas*_*ins 4 android relativelayout android-layout
我在ScrollView中有一个RelativeLayout,我已将其设置为fill_parent.但是,它只能水平填充,而不能垂直填充.我想在RelativeLayout中添加更多内容,但首先我要弄清楚为什么RelativeLayout不会填充ScrollView的高度.
谢谢你的帮助.
<ScrollView
android:id="@+id/scrollView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/gray"
android:layout_below="@+id/previewButton"
android:layout_marginTop="10dp" >
<RelativeLayout
android:id="@+id/relativeLayout"
android:layout_below="@+id/matchingWordsLabel"
android:background="@color/white"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentTop="true"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
>
<TextView
android:id="@+id/titleLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:text="Title:"
/>
<EditText
android:id="@+id/title"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/titleLabel"
android:layout_alignBaseline="@+id/titleLabel"
android:ems="10" />
</RelativeLayout>
</ScrollView>
Run Code Online (Sandbox Code Playgroud)
laa*_*lto 10
加
android:fillViewPort="true"
Run Code Online (Sandbox Code Playgroud)
到了ScrollView.
fill_parent或者match_parent内部的高度ScrollView并没有真正意义,它被忽略了 - 否则就不需要滚动了.fillViewPort="true"使滚动视图占据屏幕上可用的所有垂直空间.
| 归档时间: |
|
| 查看次数: |
1832 次 |
| 最近记录: |