由网友(八百逗比奔北波)分享简介:我不能让一个滚动型正常滚动。它总是切断在底部的内容,就好像它是一个正常的LinearLayout I can't make a ScrollView properly scrolling. It always cut off the content on the bottom, as if it were a nor...
我不能让一个滚动型正常滚动。它总是切断在底部的内容,就好像它是一个正常的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" >
相关推荐
最新文章