首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >非拉伸ScrollView

非拉伸ScrollView
EN

Stack Overflow用户
提问于 2011-03-03 18:12:46
回答 2查看 2.4K关注 0票数 5

我有一个滚动视图内的线性布局,这是我的布局文件

代码语言:javascript
运行
复制
<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>

我希望ScrolView的高度取决于它的内容-包装它,然而,如果这个高度使整个布局高度超过屏幕尺寸,它应该固定以适应屏幕的高度。怎样才能实现呢?

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2011-03-03 21:04:26

如果您希望滚动视图填满整个屏幕,即使数据不足以做到这一点,那么可以尝试执行此操作

代码语言:javascript
运行
复制
<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>
票数 7
EN

Stack Overflow用户

发布于 2015-08-30 20:17:53

将此作为属性添加到滚动视图中

代码语言:javascript
运行
复制
android:fillViewport="true"
票数 -1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/5179283

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档