greentree
greentree

Reputation: 45

Android Scrollview doesn't show up all the content

I am trying to display listviews and scroll down them in the page. However, scroll doesn't show up all the content, scrolls only like 30dp and there are a lot more listviews to display. There are many questions regarding this but they don't work on my code. I would appreciate if you could tell me what i am missing in the code below. Thank you

<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/scrollView"
xmlns:android="http://schemas.android.com/apk/res/android"
android:fillViewport="false">
<LinearLayout
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="fill_parent"
        android:layout_height="183dp"
        tools:context=".MainActivity"
        android:weightSum="1"
        android:id="@+id/rel">

        <android.support.v4.view.ViewPager
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/pager"
            android:layout_width="fill_parent"
            android:layout_height="171dp"
            android:layout_alignParentTop="true"
            android:layout_marginLeft="0dp"
            android:layout_alignParentBottom="true">
        </android.support.v4.view.ViewPager>
    </RelativeLayout>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="wrap_content"
        android:layout_height="479dp"
        tools:context=".MainActivity"
        android:weightSum="1"
        android:id="@+id/rel2"
        android:gravity="left|right">

        <ListView xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/listView"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_alignParentLeft="true"
            android:layout_alignParentStart="true"
            android:layout_alignWithParentIfMissing="false" />

    </RelativeLayout>


</LinearLayout>

Upvotes: 1

Views: 867

Answers (1)

sonic
sonic

Reputation: 1904

You should never put a ListView inside a ScrollView. This can, and probably will, cause the list view to have bad beahvior like not scrolling.

Upvotes: 4

Related Questions