最近,我使用
Android设计支持库,我的崩溃工具栏中有以下代码.
- <android.support.design.widget.CoordinatorLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:app="http://schemas.android.com/apk/res-auto"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- >
- <android.support.design.widget.AppBarLayout
- android:id="@+id/media_detail_appbar"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
- >
- <android.support.design.widget.CollapsingToolbarLayout
- android:id="@+id/collapsing_toolbar"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- app:layout_scrollFlags="scroll|exitUntilCollapsed"
- app:contentScrim="?attr/colorPrimary"
- >
- <include
- layout="@layout/layout_card"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- />
- <android.support.v7.widget.Toolbar
- android:id="@+id/media_detail_toolbar"
- android:layout_width="match_parent"
- android:layout_height="?attr/actionBarSize"
- app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
- app:layout_collapseMode="pin"
- />
- </android.support.design.widget.CollapsingToolbarLayout>
- </android.support.design.widget.AppBarLayout>
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="vertical"
- app:layout_behavior="@string/appbar_scrolling_view_behavior"
- >
- <android.support.design.widget.TabLayout
- android:id="@+id/media_detail_tabs"
- android:layout_width="match_parent"
- android:layout_height="?android:attr/actionBarSize"
- android:background="@color/blue_2"
- app:tabMode="scrollable"
- />
- <android.support.v4.view.ViewPager
- android:id="@+id/view_pager"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- />
- </LinearLayout>
- </android.support.design.widget.CoordinatorLayout>
View Pager有两个片段.一个是NestedScrollView,另一个是Recycler View.我的问题是NestedScrollView,这里是下面的代码.
- <android.support.v4.widget.NestedScrollView
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- >
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical"
- >
- </LinearLayout>
- </android.support.v4.widget.NestedScrollView>
我的问题是,当您向上滚动视图时,只要手指在侧面移动一点,它将触发视图寻呼机的水平滚动.请帮我避免吗?当我们上下滚动时,不应该触发视图寻呼机.它在我的回收商视图片段中运行良好.谢谢.