滚动型不滚动在所有 [英] ScrollView not scrolling at all

查看:130
本文介绍了滚动型不滚动在所有的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不能让一个滚动型正常滚动。它总是切断在底部的内容,就好像它是一个正常的LinearLayout

I can't make a ScrollView properly scrolling. It always cut off the content on the bottom, as if it were a normal LinearLayout.

我的code

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fillViewport="true" >

    <LinearLayout android:id="@+id/scroll_layout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:isScrollContainer="true"
        android:orientation="vertical" >

当然,我已经尝试添加/删除fillViewport和isScrollContainer属性,它并没有改变任何东西。

Of course, I already tried to add / remove the "fillViewport" and "isScrollContainer" properties, and it did not change anything at all.

在此先感谢。

推荐答案

答:作为一个XML布局的根元素使用时,滚动型是行不通的。它必须是一个的LinearLayout里面裹。

Answer: the ScrollView is not working when used as the root element of an XML layout. It has to be wrapped inside a LinearLayout.

解决方案则:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <ScrollView android:id="@+id/scroll_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fillViewport="true" >

        <LinearLayout android:id="@+id/scroll_layout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical" >

这篇关于滚动型不滚动在所有的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆