Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to vertical scroll in Android Activity

Tags:

android

scroll

I have the following layout:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:isScrollContainer="true"
    android:orientation="vertical">

    <Gallery
        android:id="@+id/gallery"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:gravity="bottom" />

    <LinearLayout
        android:id="@+id/chart"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:orientation="horizontal" />
    
</LinearLayout>

Gallery is filled at runtime and when the user taps on an item I fill the LinearLayout with a series of images.
I would like to scroll vertically but if I add a ScrollView when the user taps the Gallery the LinearLayout is not filled anymore.

Is it normal? How can I add a vertical scroll?

like image 374
Cris Avatar asked Mar 22 '11 15:03

Cris


1 Answers

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:orientation="vertical"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent">
<ScrollView android:id="@+id/ScrlView" android:layout_width="fill_parent" android:layout_height="fill_parent" >
 <LinearLayout android:id="@+id/layoutForScroll" android:orientation="vertical"
    android:layout_width="fill_parent" android:layout_height="wrap_content"        
    >
   <Gallery android:id="@+id/gallery"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:gravity="bottom"/>
  <LinearLayout android:id="@+id/chart" android:orientation="horizontal"
    android:layout_width="fill_parent" android:layout_height="wrap_content"          
    android:layout_weight="1" />
</LinearLayout>
</ScrollView>
</LinearLayout>
like image 119
dilipkaklotar Avatar answered Oct 08 '22 00:10

dilipkaklotar