请帮助我,我的ViewPager在NestedScrollView中不可见。我该怎么办?我花了很多时间试图让vp可见,但它并不成功。如果我设置viewpager的固定高度,那么它将是可见的,但我不希望这样。这是我的xml:
<android.support.design.widget.CoordinatorLayout 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:fitsSystemWindows="true"
tools:context=".activities.StoryDetailActivity">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:contentScrim="?attr/colorPrimary"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<ImageView
android:id="@+id/img_banner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:contentDescription="@string/app_name"
android:src="@drawable/test"
app:layout_collapseMode="parallax"
app:layout_scrollFlags="scroll|enterAlways|enterAlwaysCollapsed" />
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin"
app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="@style/AppTheme.PopupOverlay" />
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="@dimen/dimen_6x"
android:orientation="horizontal"
android:paddingLeft="@dimen/dimen_1x"
android:paddingRight="@dimen/dimen_1x">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/dimen_1x"
android:layout_marginRight="@dimen/dimen_1x"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical"
android:paddingLeft="@dimen/dimen_1x"
android:paddingRight="@dimen/dimen_1x">
<com.nm.story.widgets.textview.TextViewLight
android:id="@+id/lbl_views"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/textColorSecondary"
android:textSize="@dimen/text_size_xnormal" />
<ImageView
android:layout_width="@dimen/tiny_icon"
android:layout_height="@dimen/tiny_icon"
android:contentDescription="@string/app_name"
android:src="@drawable/ic_visibility_grey" />
</LinearLayout>
<View
android:layout_width="@dimen/divider"
android:layout_height="match_parent"
android:layout_marginBottom="@dimen/dimen_1x"
android:layout_marginTop="@dimen/dimen_1x"
android:background="@color/dividerColor" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/dimen_1x"
android:layout_marginRight="@dimen/dimen_1x"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical"
android:paddingLeft="@dimen/dimen_1x"
android:paddingRight="@dimen/dimen_1x">
<com.nm.story.widgets.textview.TextViewLight
android:id="@+id/lbl_likes"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/textColorSecondary"
android:textSize="@dimen/text_size_xnormal" />
<ImageView
android:layout_width="@dimen/tiny_icon"
android:layout_height="@dimen/tiny_icon"
android:contentDescription="@string/app_name"
android:src="@drawable/ic_like_grey" />
</LinearLayout>
<View
android:layout_width="@dimen/divider"
android:layout_height="match_parent"
android:layout_marginBottom="@dimen/dimen_1x"
android:layout_marginTop="@dimen/dimen_1x"
android:background="@color/dividerColor" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/dimen_1x"
android:layout_marginRight="@dimen/dimen_1x"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical"
android:paddingLeft="@dimen/dimen_1x"
android:paddingRight="@dimen/dimen_1x">
<com.nm.story.widgets.textview.TextViewLight
android:id="@+id/lbl_chapter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:textColor="@color/textColorSecondary"
android:textSize="@dimen/text_size_xnormal" />
</LinearLayout>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="@dimen/divider"
android:layout_marginLeft="@dimen/dimen_2x"
android:layout_marginRight="@dimen/dimen_2x"
android:background="@color/dividerColor" />
<com.nm.story.widgets.textview.TextViewItalic
android:id="@+id/lbl_review"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/dimen_2x"
android:maxLines="6"
android:textColor="@color/textColorPrimary"
android:textSize="@dimen/text_size_xnormal" />
<android.support.v4.view.ViewPager
android:id="@+id/pager_chapter"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dimen_2x"
android:layout_marginRight="@dimen/dimen_2x" />
<android.support.design.widget.TabLayout
android:id="@+id/tabs_chapter"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dimen_2x"
android:layout_marginRight="@dimen/dimen_2x"
app:tabMode="scrollable" />
</LinearLayout>
</android.support.v4.widget.NestedScrollView></android.support.design.widget.CoordinatorLayout>