Disable the nested scrollview during horizontal scrolling in android
<p>I have created the horizontal listview inside the nested scrollview. Horizontal listview not scroll smoothly due to vertical scrolling action works on background. I have tried to stop vertical scrolling using listview ontouchlistner. Its working fine.But if i touch the horizontal listview the vertical scrolling gets stop.so i don't want to stop the vertical scrolling stop during on touch.I want to stop the vertical scroll-view at the time horizontal listview scrolls.Any one help me to fix this issue.`  </p>

<pre><code>try {
        JSONObject jsonRootObject = new JSONObject(data);
        JSONArray jsonArray = jsonRootObject.optJSONArray("new_hotel");

        //Iterate the jsonArray and print the info of JSONObjects
        for (int i = 0; i &lt; jsonArray.length(); i++) {
            JSONObject jsonObject = jsonArray.getJSONObject(i);

            //   int id = Integer.parseInt(jsonObject.optString("hotel_id").toString());
            String name = jsonObject.optString("hotel_name").toString();
            final String image = jsonObject.optString("logo").toString();
            Log.d("response", "response -----" + image);

            Movie movie = new Movie();


            movie.sethorizontal1_title(jsonObject.optString("hotel_name").toString());
            movie.sethorizontal1_image(jsonObject.optString("logo").toString());
            movie.sethorizontal1_hotelid(jsonObject.optString("hotel_id").toString());
            movie.sethorizontal1_city(jsonObject.optString("city").toString());
            movieList.add(movie);
            listview1.setAdapter(adapter1);
            listview1.setOnTouchListener(new HorizontalListView.OnTouchListener() {
                @Override
                public boolean onTouch(View v, MotionEvent event) {
                    int action = event.getAction();
                    switch (action) {
                        case MotionEvent.ACTION_DOWN:
                            // Disallow ScrollView to intercept touch events.
                            v.getParent().requestDisallowInterceptTouchEvent(true);
                            break;

                        case MotionEvent.ACTION_UP:
                            // Allow ScrollView to intercept touch events.
                            v.getParent().requestDisallowInterceptTouchEvent(false);
                            break;
                    }

                    // Handle HorizontalScrollView touch events.
                    v.onTouchEvent(event);
                    return true;
                }
            });



            adapter1.notifyDataSetChanged();

        }
    } catch (Exception e) {
        e.printStackTrace();
    }
</code></pre>

<p>`
This is my xml code:</p>

<pre><code> &lt;android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/drawer"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    tools:context=".Home"&gt;

    &lt;LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"&gt;

        &lt;include
            android:id="@+id/toolbar"
            layout="@layout/tool_bar" /&gt;
        &lt;android.support.design.widget.CoordinatorLayout

            android:layout_width="match_parent"
            android:layout_height="match_parent"

            android:background="?android:attr/colorBackground"&gt;

            &lt;android.support.design.widget.AppBarLayout
                android:id="@+id/materialup_appbar"
                android:layout_width="match_parent"
                android:layout_height="300dp"
                android:background="@null"


                android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
                &gt;
                &lt;android.support.design.widget.CollapsingToolbarLayout
                    android:id="@+id/collapse_toolbar"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"


                    app:expandedTitleTextAppearance="@android:color/transparent"
                    app:layout_scrollFlags="scroll|exitUntilCollapsed"
                    &gt;​

                    &lt;ImageView
                        android:layout_width="match_parent"
                        android:layout_height="300dp"
                        android:src="@drawable/sample"
                        android:scaleType="fitXY"
                        android:id="@+id/homeimage"
                        android:adjustViewBounds="true"
                        app:layout_collapseMode="parallax"
                        app:layout_collapseParallaxMultiplier="1.0"/&gt;
                &lt;/android.support.design.widget.CollapsingToolbarLayout&gt;
            &lt;/android.support.design.widget.AppBarLayout&gt;

            &lt;android.support.v4.widget.NestedScrollView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                app:layout_behavior="@string/appbar_scrolling_view_behavior"
                android:id="@+id/nest_scrollview"
                android:fillViewport="true"
                android:scrollbarStyle="insideOverlay"
                android:layout_gravity="fill_vertical"&gt;

                &lt;LinearLayout
                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent"
                    android:orientation="vertical"&gt;

                    &lt;TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Hi UserName"
                        android:textSize="30dp"
                        android:gravity="left"
                        android:id="@+id/home_username"
                        android:layout_marginLeft="10dp"
                        android:layout_marginRight="10dp"
                        /&gt;
                    &lt;TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"

                        android:textSize="30dp"
                        android:gravity="left"
                        android:layout_marginLeft="10dp"
                        android:layout_marginRight="10dp"
                        /&gt;
                    &lt;ImageView
                        android:layout_width="match_parent"
                        android:layout_height="10dp"
                        android:background="@drawable/horizontalline"
                        android:layout_marginLeft="10dp"
                        android:layout_marginRight="10dp"/&gt;
                    &lt;TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="New Hotels"
                        android:textSize="15dp"
                        android:gravity="left"
                        android:layout_marginLeft="10dp"
                        android:layout_marginRight="10dp"
                        /&gt;



                    &lt;com.airstar.abservetech.adapter.HorizontalListView
                        android:id="@+id/listview1"
                        android:layout_width="fill_parent"
                        android:layout_height="270dp"
                        android:background="#ddd"
                        android:scrollbarStyle="outsideOverlay"
                        /&gt;
                    &lt;ImageView
                        android:layout_width="match_parent"
                        android:layout_height="10dp"
                        android:background="@drawable/horizontalline"
                        android:layout_marginTop="10dp"
                        android:layout_marginLeft="10dp"
                        android:layout_marginRight="10dp"/&gt;



                &lt;/LinearLayout&gt;

            &lt;/android.support.v4.widget.NestedScrollView&gt;
        &lt;/android.support.design.widget.CoordinatorLayout&gt;

    &lt;/LinearLayout&gt;

    &lt;android.support.design.widget.NavigationView
        android:id="@+id/navigation_view"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        app:headerLayout="@layout/header"
        app:menu="@menu/drawer" /&gt;
&lt;/android.support.v4.widget.DrawerLayout&gt;
</code></pre>