首页 > 解决方案 > 滚动视图和嵌套滚动视图不起作用

问题描述

我在滚动视图和嵌套滚动视图中使用这种布局方式的滚动视图都不起作用

<RelativeLayout>
<scrollview>
 <LinearLayout>
   <LinearLayout> 
   </LinearLayout>
   <LinearLayout> 
   </LinearLayout>
 </LinearLayout>
</scrollview>  
</RelativeLayout>

在 scorll 视图中,我正在尝试填充视图,滚动条也像这样垂直,但这一切都不起作用。我在片段里面做。

标签: androidscrollview

解决方案


它在我的代码中运行良好,

你可以试试这个:

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

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical" >

        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal" >

            //Your Widgets....

        </LinearLayout>

        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal" >

           //Your Widgets....

        </LinearLayout>
     </LinearLayout>
   </ScrollView>

推荐阅读