Sol*_*vek 5 android scrollview
我在衬里布局中有一个滚动视图,这是我的布局文件
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<!-- Other widgets go here -->
<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<!-- Scroll view content -->
</ScrollView>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
我希望ScrolView的高度取决于其内容 - 包装它,但是如果这个高度使整个布局高度超过屏幕尺寸,则应该将其固定以适应屏幕的高度.如何实现呢?
如果您希望滚动视图填满整个屏幕,即使数据不够,也请尝试使用它
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<!-- Other widgets go here -->
<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:fillViewport="true">
<!-- Scroll view content -->
</ScrollView>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1912 次 |
| 最近记录: |