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>
4

2 回答 2

1

您必须将 LinearLayout 包装在 ScrollView 中。并删除 LinearLayout 中的滚动参数,它们没有效果。

注意:一个 ScrollView 只能有一个嵌套的孩子!所以它应该是你的主要布局。

于 2012-07-05T13:48:36.540 回答
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>
于 2012-07-05T13:59:49.220 回答