<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white"
tools:context="com.app.trainingapp.home.activity.ProductInfoDetail">
<android.support.design.widget.AppBarLayout
android:id="@+id/appBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay"
android:visibility="visible">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="@dimen/toolbar_height"
android:background="@color/colorPrimary"
android:visibility="visible"
app:contentInsetEnd="0dp"
app:contentInsetLeft="0dp"
app:contentInsetRight="0dp"
app:contentInsetStart="0dp"
app:layout_collapseMode="parallax"
app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="@style/AppTheme.PopupOverlay">
<include layout="@layout/toolbar_product_detail" />
</android.support.v7.widget.Toolbar>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:id="@+id/detail_view_pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/appBar"
android:fillViewport="true"
android:focusableInTouchMode="true"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/top_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="1">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.4">
<ImageView
android:layout_width="wrap_content"
android:layout_height="@dimen/product_detail_top_height"
android:padding="@dimen/product_image_padding"
android:src="@drawable/product" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="@dimen/product_detail_top_height"
android:layout_weight="0.6"
android:gravity="center_vertical|center_horizontal">
<com.app.trainingapp.customviews.TypefacedTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:ellipsize="end"
android:text="@string/dummy_text"
android:textColor="@color/faint_black"
app:customTypeface="RalewayRegular" />
</LinearLayout>
</LinearLayout>
<View
android:id="@+id/separator"
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:layout_below="@id/top_container"
android:layout_marginLeft="@dimen/view_margin_left"
android:layout_marginRight="@dimen/view_margin_left"
android:background="@color/view_color_grey" />
<com.app.trainingapp.customviews.TypefacedTextView
android:id="@+id/txt_medication"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/separator"
android:layout_marginTop="@dimen/top_10"
android:paddingLeft="@dimen/left_10"
android:text="@string/str_medication"
android:textAllCaps="true"
android:textColor="@android:color/black"
android:textSize="@dimen/font_medication"
app:customTypeface="RalewayBold" />
<com.app.trainingapp.utils.FlowLayout
android:id="@+id/flow_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/txt_medication"
android:layout_marginTop="@dimen/top_10"
android:paddingLeft="20dp"
android:visibility="visible"
app:horizontalSpacing="@dimen/flow_item_horizaontal_spacing"
app:orientation="horizontal"
app:verticalSpacing="@dimen/flow_item_vertical_spacing" />
<com.app.trainingapp.customviews.CustomViewPager
android:id="@+id/medication_pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/flow_container"
android:layout_marginTop="@dimen/top_10">
<android.support.design.widget.TabLayout
android:id="@+id/medication_tabs"
android:layout_width="match_parent"
android:layout_height="@dimen/tab_layout_height"
android:layout_gravity="top"
android:background="@drawable/tablayout_line"
app:tabIndicatorColor="@color/tab_selector_color"
app:tabMode="scrollable" />
<!--<View-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="0.5dp"-->
<!--android:layout_below="@id/medication_tabs"-->
<!--android:background="@color/view_color_grey" />-->
</com.app.trainingapp.customviews.CustomViewPager>
</RelativeLayout>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
检查上面的xml,我有viewpager insite NestedScrollView, 我想用viewpager滚动整个页面? 我的问题是当我尝试滚动页面时它不起作用并且viewpager在内部滚动。 如果代码中有任何问题,请告诉我。