0

I am using viewpager and fragments and display different section. At bottom, I have used Horizontallistview from A to Z and if i click display respective data with letter indicates.

Problem: When I am trying to scrolling bottom horizontal view pager execute(slow horizonalistview) and goes to next page but my intention is scolling horizontallistview. In here, why not horizontallistview smoothly scrolling.

enter image description here

I used viewpager in MainActivity;

<android.support.v4.view.ViewPager
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:id="@+id/pager"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/rlv2"
        android:layout_marginTop="-40dp" >

        <android.support.v4.view.PagerTabStrip
            android:id="@+id/pager_title_strip"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:paddingBottom="4dp"
            android:paddingTop="4dp"
            android:textColor="@color/black"
            android:textStyle="bold" />
    </android.support.v4.view.ViewPager>

and bottom horizontalistview putting in fragment activity.

<com.devsmart.android.ui.HorizontalListView
        android:id="@+id/hlistview"
        android:layout_width="match_parent"
        android:layout_height="40dp"
        android:layout_alignParentBottom="true"
        android:background="@drawable/textviewborder"
        android:focusableInTouchMode="true"
        android:overScrollMode="always" />

So, How to solve this problem. I want to smoothly horizontal list view.

B B
  • 63
  • 6
  • Have you tried to search before asking? http://stackoverflow.com/questions/6920137/android-viewpager-and-horizontalscrollview – Yaroslav Jul 10 '15 at 07:21

1 Answers1

2

Simple, you can just put in your oncreate and make OnTouchListener.

hListView.setOnTouchListener(new View.OnTouchListener() {
    @Override
    public boolean onTouch(View arg0, MotionEvent arg1) {
    // TODO Auto-generated method stub
    hListView.requestDisallowInterceptTouchEvent(true);
    return false;
    }
});

Hope this will help you.

Horrorgoogle
  • 7,858
  • 11
  • 48
  • 81