0

I want to scroll a portion of data in the screen, for which I added scrollview in the layout, but the listview is not getting scrolled, its working fine in emulator. I read all articles related to which says listview scrolling is not possible and tried alternatives designing custom scroll but only portion of data is not getting scrolled. Why is this so? No other alternatives?

My layout is something like

<ScrollView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/scrollView1"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fillViewport="true">
   //few more layout items goes here
 <LinearLayout  android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">

        <ListView android:id="@+id/listView"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1"
            android:divider="#00000000"
            android:dividerHeight="5dp"
            android:textStyle="bold"
            android:typeface="serif"
            />
        <LinearLayout  android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Total"
                android:textStyle="bold"
                android:textColor="#F5D8BA"
                android:layout_marginRight="30dp"
                android:layout_gravity="center"
                android:typeface="serif"
                />
       </LinearLayout>
 </LinearLayout>
</ScrollView>

and the data inside listview is like

<ScrollView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/scrollView1"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:fillViewport="true">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal"
    android:layout_weight="1"
    >
<LinearLayout
    android:layout_width="75dp"
    android:layout_height="wrap_content" android:orientation="vertical">

    <TextView
        android:id="@+id/textView1"
        android:layout_gravity="center"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:textSize="12dp"
        android:textColor="#000000"
        android:text="TextView"
        android:textStyle="bold"
        android:typeface="serif"
        />

    <TextView
        android:id="@+id/textViewStyle"
        android:layout_gravity="center"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:textSize="12dp"
        android:textColor="#000000"
        android:textStyle="bold"
        android:typeface="serif"
        />

</LinearLayout>
   </LinearLayout>
    </ScrollView>
Narendra Singh
  • 3,990
  • 5
  • 37
  • 78
Annyy07
  • 3
  • 5
  • 1
    remove scroll view from listview data... – Rishad Appat May 19 '15 at 13:10
  • You dont need ScrollView while using ListView .. further you could add header or footer view to ListView – Navdroid May 19 '15 at 13:14
  • yes its working now,but i had few elements below list view its going out of view,i mean pushed inside screen ,so i added scrollview,how will i handle that? i had few buttons and other section. – Annyy07 May 19 '15 at 13:52

0 Answers0