0

I have applied scroll view to the entire layout and that layout has one listview. when running the application in the emulator both scroll views are working one scroll view for entire layout and another scroll view for listview (both works fine). but when i installed my app in the phone only outer scroll view is working scroll view for listview is not working. Can any one please tell me the reason and solution for my problem.

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


<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/bg4"
android:orientation="vertical"
android:scrollbarAlwaysDrawVerticalTrack="true" >
 <ListView
        android:id="@+id/listViewTickets"
        android:layout_width="match_parent"
        android:layout_height="200dp"
        android:layout_gravity="center_horizontal"
        android:layout_marginTop="10dp" >
    </ListView>
<LinearLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="right"
    android:layout_marginBottom="70dp"
    android:orientation="horizontal"
    >

    <Button
        android:id="@+id/btnNew"
        android:layout_width="80dp"
        android:layout_height="30dp"
        android:background="@drawable/btnnew" />

    <Button
        android:id="@+id/btnUpdate"
        android:layout_width="80dp"
        android:layout_height="30dp"
        android:layout_marginLeft="10dp"
        android:layout_marginRight="10dp"
        android:background="@drawable/edit" />
</LinearLayout>

The content of list view is displayed dynamically.

rams
  • 69
  • 2
  • 10

2 Answers2

0

A list view is already scrollable so you can't add it to a scroll view. Here's a similar question and an answer from the Google engineer in charge of the ListView: How can I put a ListView into a ScrollView without it collapsing?

Community
  • 1
  • 1
IncrediApp
  • 10,303
  • 2
  • 33
  • 24
0

I have found the youtube video Google I/O 2010 - The world of ListView an essential watch. In it it's mentioned to never use multiple scrolling widgets unless they scroll on a different axis.

Seamus Boyle
  • 99
  • 1
  • 3