Android_Developer
Android_Developer

Reputation: 37

scroll view in android not generated

I developed a user form which has different widget. i set scrolling option but not able to generate scrollbar so not able scroll upto the last option. following is the code. can any one guide me to solve this problme

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

Upvotes: 3

Views: 251

Answers (2)

IAmGroot
IAmGroot

Reputation: 13855

You must wrap your linear layout in a scroll view. Here is an example:

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

Upvotes: 1

Benito Bertoli
Benito Bertoli

Reputation: 25793

You have to wrap your LinearLayout in a ScrollView. And delete the params of scrolling in your LinearLayout they have no effect.

NOTE: a ScrollView can only have one nested child! So it should be your main layout.

Upvotes: 1

Related Questions