1

i search lot of topic about scrollview which doesn't scroll but no one can resolve my issue :/ if someone could help me :) each listview print some people when i do a request from my server normally when i scroll down of my list the second list appear but it does not

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/selector_for_background_white"
    android:orientation="vertical">

    <ScrollView
        android:id="@+id/scrollView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@drawable/selector_for_background_white"
        android:fillViewport="true">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <LinearLayout
                android:id="@+id/layoutScrollResult"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical">

                <RelativeLayout
                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent"
                    android:background="@drawable/selector_for_background_white">

                    <LinearLayout
                        android:id="@+id/layout2"
                        android:layout_width="match_parent"
                        android:layout_height="40dp"
                        android:orientation="horizontal">

                        <com.whask.whask.utils.font.FontTextView
                            android:id="@+id/text_hot"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_centerVertical="true"
                            android:layout_gravity="center"
                            android:layout_marginLeft="10dp"
                            android:layout_marginStart="10dp"
                            android:background="@android:color/transparent"
                            android:text="5 HOT"
                            android:textSize="@dimen/abc_text_size_medium_material"
                            app:font="Neo-Sans-Std-Medium.otf"/>
                    </LinearLayout>


                    <ListView
                        android:id="@+id/result_whask_listview_view"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_below="@+id/layout2">
                    </ListView>

                    <LinearLayout
                        android:id="@+id/layout3"
                        android:layout_width="match_parent"
                        android:layout_height="40dp"
                        android:layout_below="@+id/result_whask_listview_view"
                        android:orientation="horizontal">

                        <com.whask.whask.utils.font.FontTextView
                            android:id="@+id/text_not"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_centerVertical="true"
                            android:layout_gravity="center"
                            android:layout_marginLeft="10dp"
                            android:layout_marginStart="10dp"
                            android:background="@android:color/transparent"
                            android:text="2 NOT"
                            android:textSize="@dimen/abc_text_size_medium_material"
                            app:font="Neo-Sans-Std-Medium.otf"/>
                    </LinearLayout>

                    <ListView
                        android:id="@+id/result_whask_listview_view_no"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_below="@+id/layout3"
                        android:background="@color/my_whask_white_color">
                    </ListView>

                </RelativeLayout>

            </LinearLayout>

        </LinearLayout>

    </ScrollView>

</LinearLayout>
  • you should not use scrollview with listview as listview has it's own scrolling. Instead of using listview inflate your items in linear or frame layout. In this way you can easily achieve wrap content feature as listview doesn't work properly with wrap content – Vivek Mishra Mar 09 '16 at 11:34
  • do you want to scroll listview inside scrollview ? @Mavrick Rmx – RushDroid Mar 09 '16 at 11:37
  • if i dont use ScrollView, my 2 FontTextView will not scroll and my second listview stay at the bottom and i can't see these elements, i need that my FontTextView scroll too @VivekMishra – Mavrick Rmx Mar 09 '16 at 11:41
  • I am not saying you should not use scrollview. I am saying not to use listview inside scrollview. – Vivek Mishra Mar 09 '16 at 11:42
  • yes this is what i want, then my listView which are at bottom of my screen can replace the first listview @Rushabh042 – Mavrick Rmx Mar 09 '16 at 11:43
  • Check my answer that way you can scroll listview and scrollview properly its working for me @MavrickRmx – RushDroid Mar 09 '16 at 11:43
  • you should replace both of your listview with dynamically inflated views inside a linear layout as a container for them – Vivek Mishra Mar 09 '16 at 11:43
  • well i can't imagine how i can scroll all my view and display list of people whithout using listview inside scrollview :/ @VivekMishra – Mavrick Rmx Mar 09 '16 at 11:44
  • have you check my answer ? @MavrickRmx – RushDroid Mar 09 '16 at 11:48
  • then imagine it by searching how to inflate linear layout dynamically. This link can help you to imagine that way http://stackoverflow.com/questions/9908883/programmatically-add-views-inside-a-linearlayout-that-is-inside-a-scrollview – Vivek Mishra Mar 09 '16 at 11:48

2 Answers2

1

DO NOT use ListView inside ScrollView. ListView itself has a scroll property and you don't have to use another ScrollView to make it scroll. Use a LinearLayout instead.

Jas
  • 3,207
  • 2
  • 15
  • 45
1

Listview have own scrolling property ,so dont use within scrollview... thanks

Gaurav Rawal
  • 218
  • 1
  • 6