Note that there are some explanatory texts on larger screens.

plurals
  1. POAdd vertical scrolling to a section of android viewPager
    primarykey
    data
    text
    <p>I have a viewPager that I populate using a FragmentStatePagerAdapter. It works fine, can go through populated pages horizontally.</p> <p>However the middle section of each page on the viewPager is made up of a listView. This listview will sometimes not fit into the designated area, I need to be able to scoll vertically. But I cannot scroll vertically on this section of the viewPager at the moment.</p> <p>It looks like the viewPager is consuming all the scroll events (both horizontal and vertical).</p> <p>I do not want a vertical viewPager; I have seen a few answers to that on StackOverflow.</p> <p>I want only the section in the middle of the viewPager to scroll vertical, and this section is a listView</p> <p>This is the mainlayout for the tab with a viewPager:</p> <pre><code> &lt;LinearLayout android:id="@+id/history" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:background="@color/fdi_gray"&gt; &lt;android.support.v4.view.ViewPager android:id="@+id/historyFragment_container" android:layout_weight="0.85" android:layout_width="fill_parent" android:layout_height="0dip"/&gt; &lt;include layout="@layout/page_indicator_history" android:layout_height="0dip" android:layout_width="fill_parent" android:layout_weight="0.05" android:background="@color/darker_gray" android:layout_marginTop="2dp"/&gt; &lt;/LinearLayout&gt; </code></pre> <p>And the layout out that is used by the ViewPager adapter to populate above viewPager is this:</p> <pre><code>&lt;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="wrap_content" android:id="@+id/spaceHolderLocations"&gt; &lt;TextView android:id="@+id/locationName" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center" android:layout_marginTop="10dp" android:layout_centerHorizontal="true" android:textStyle="bold" android:textSize="17sp"/&gt; &lt;TextView android:id="@+id/latlon" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center" android:layout_below="@+id/locationName" android:layout_marginTop="2dp" android:layout_marginBottom="3dp" android:layout_centerHorizontal="true"/&gt; &lt;View android:id="@+id/listViewStart" android:layout_width="match_parent" android:layout_height="0.5dip" android:layout_marginLeft="3dp" android:layout_marginRight="3dp" android:layout_below="@+id/latlon" android:background="@color/white" /&gt; &lt;ListView android:id="@android:id/list" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/fdi_gray" android:layout_below="@+id/listViewStart" android:layout_marginLeft="3dp" android:layout_marginRight="3dp" android:divider="@color/white" android:dividerHeight="0.5dip" android:padding="1dp"&gt; &lt;/ListView&gt; &lt;View android:id="@+id/listViewEnd" android:layout_width="match_parent" android:layout_height="0.5dip" android:layout_marginLeft="3dp" android:layout_marginRight="3dp" android:layout_below="@android:id/list" android:background="@color/white" /&gt; &lt;TextView android:id="@+id/curingLabel" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/listViewEnd" android:gravity="center" android:text="@string/curingLabel" android:layout_marginTop="10dp" android:layout_marginLeft="30dp" android:textSize="17sp"/&gt; &lt;TextView android:id="@+id/curingValue" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toRightOf="@+id/curingLabel" android:layout_marginLeft="30dp" android:layout_alignBottom="@+id/curingLabel" android:textStyle="bold" android:textSize="17sp"/&gt; </code></pre> <p></p> <p>Please note the listview in the above layout.</p> <p>That's the section of the ViewPager that I want to be able to scroll on; but cannot, I can only scroll horizontally through the pages not vertically through the listView content if it doesn’t fit the page.</p> <p>This question came close but it's not what I'm looking for: <a href="https://stackoverflow.com/questions/8381697/viewpager-inside-a-scrollview-does-not-scroll-correclty">link</a></p> <p>Thanks.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload