我正在将 CollapsingBarLayout 与 viewpager 一起使用,并且 viewpager 的片段具有 listview、gridview。
这是我的代码:
<?xml version="1.0" encoding="utf-8"?>
<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:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.bigsteptech.seandroidnativeapp.classes.modules.common.ViewGroupEvent">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
android:fitsSystemWindows="true">
<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"
android:fitsSystemWindows="true"
app:contentScrim="?attr/colorPrimary"
app:expandedTitleMarginEnd="64dp"
app:expandedTitleMarginStart="48dp"
app:expandedTitleTextAppearance="@style/TransparentText">
<FrameLayout
android:id="@+id/carouselLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_collapseMode="parallax">
<ImageView
android:id="@+id/coverImage"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"/>
<LinearLayout
android:layout_width="match_parent"
android:gravity="bottom"
android:orientation="vertical"
android:layout_gravity="bottom"
android:padding="@dimen/profile_image_margin"
android:background="@drawable/gradient_bg"
android:layout_height="wrap_content">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/profile_image_margin"
android:textSize="@dimen/text_size_xlarge"
android:textStyle="bold"
android:textColor="@color/white"
android:id="@+id/content_title"/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_marginLeft="@dimen/profile_image_margin"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textStyle="bold"
android:textColor="@color/white"
android:textSize="@dimen/text_size_medium"
android:id="@+id/category_title"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textStyle="bold"
android:layout_toRightOf="@+id/category_title"
android:layout_marginLeft="@dimen/profile_image_margin"
android:textColor="@color/white"
android:textSize="@dimen/text_size_medium"
android:id="@+id/memberCount"/>
</RelativeLayout>
</LinearLayout>
</FrameLayout>
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:theme="@style/ActionBarThemeOverlay"
app:popupTheme="@style/ActionBarPopupThemeOverlay"
android:background="@drawable/gradient_bg"
app:layout_collapseMode="pin" />
</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"
android:layout_gravity="fill_vertical"
android:isScrollContainer="true"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/contentInfo"
android:paddingBottom="48sp"
android:clipToPadding="false"
android:orientation="vertical">
<ProgressBar
style="?android:attr/progressBarStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/profile_page_left_right_margin"
android:layout_gravity="center"
android:id="@+id/progressBar"/>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:background="@color/grey_light">
<TextView android:id="@+id/ownerTitle"
android:clickable="true"
android:focusable="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/keyline_1"
android:layout_gravity="center_vertical"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
android:textColor="@color/body_text_1" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/profile_image_margin"
android:padding="10dp">
<com.bigsteptech.seandroidnativeapp.Classes.Modules.Common.ViewRelated.ExpandableTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/keyline_1"
style="@style/TextBody"
android:layout_gravity="center_vertical"
android:id="@+id/view_description" />
</LinearLayout>
<android.support.design.widget.TabLayout
android:id="@+id/slidingTabs"
android:layout_width="match_parent"
app:tabIndicatorHeight="3dp"
app:tabMode="scrollable"
android:layout_height="wrap_content"/>
<android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="300dp">
</android.support.v4.view.ViewPager>
</LinearLayout>
</RelativeLayout>
</android.support.v4.widget.NestedScrollView>
<android.support.design.widget.FloatingActionButton
android:layout_height="wrap_content"
android:layout_width="wrap_content"
app:layout_anchor="@id/appbar"
android:id="@+id/joinGroupButton"
app:layout_anchorGravity="bottom|right|end"
android:src="@drawable/ic_action_new"
android:layout_margin="@dimen/fab_margin"
android:clickable="true"/>
</android.support.design.widget.CoordinatorLayout>
具有列表视图,网格视图的片段在折叠工具栏中不会向上滚动,我该如何实现这个工作..
请帮助我,非常感谢您在高级...