Android中的滚动视图未生成

3

我开发了一个包含不同小部件的用户表单。 我设置了滚动选项,但无法生成滚动条,因此无法滚动到最后一个选项。 以下是代码。 有人可以指导我解决这个问题吗?

 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
   android:orientation="vertical" 
    android:scrollbars="vertical" 
    android:scrollbarAlwaysDrawVerticalTrack="true"
    android:scrollbarStyle="outsideInset" android:isScrollContainer="true"
    android:overScrollMode="always"
    >

  ..............

  </LinearLayout>
2个回答

1
你需要将你的LinearLayout放在一个ScrollView中,并删除LinearLayout中的滚动参数,因为它们没有任何效果。
注意:ScrollView只能有一个嵌套子元素!所以它应该是你的主要布局。

1

你必须将你的线性布局包裹在一个滚动视图中。这里是一个例子:

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/scroller"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:fillViewport="true" >

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

    // YOUR CONTENT GOES HERE

     </LinearLayout>       
</ScrollView>

@Android_Developer 嗨,请给我的答案点赞并标记为有用,谢谢 :) - IAmGroot

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接