演示在CollapsingToolbarLayout中使用TabLayout的例子:TabbedCoordinatorLayout

jopen 9年前
TabbedCoordinatorLayout是一个演示在CollapsingToolbarLayout中使用TabLayout的例子,两者均放在CoordinatorLayout中。
<?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"      android:layout_width="match_parent"      android:layout_height="match_parent"      android:fitsSystemWindows="true">         <android.support.design.widget.AppBarLayout          android:layout_width="match_parent"          android:layout_height="wrap_content"          android:fitsSystemWindows="true"          android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">             <android.support.design.widget.CollapsingToolbarLayout              android:id="@+id/collapse_toolbar"              android:layout_width="match_parent"              android:layout_height="250dp"              android:fitsSystemWindows="true"              app:contentScrim="?attr/colorPrimary"              app:layout_scrollFlags="scroll|exitUntilCollapsed">                 <ImageView                  android:id="@+id/header"                  android:layout_width="match_parent"                  android:layout_height="match_parent"                  android:background="@drawable/photo"                  android:fitsSystemWindows="true"                  android:scaleType="centerCrop"                  app:layout_collapseMode="parallax" />                 <android.support.v7.widget.Toolbar                  android:id="@+id/toolbar"                  android:layout_width="match_parent"                  android:layout_height="100dp"                  android:gravity="top"                  android:minHeight="?attr/actionBarSize"                  app:layout_collapseMode="pin"                  app:popupTheme="@style/ThemeOverlay.AppCompat.Light"                  app:titleMarginTop="15dp" />                 <android.support.design.widget.TabLayout                  android:id="@+id/tabs"                  android:layout_width="match_parent"                  android:layout_height="?attr/actionBarSize"                  android:layout_gravity="bottom"                  app:tabIndicatorColor="@color/colorAccent" />             </android.support.design.widget.CollapsingToolbarLayout>         </android.support.design.widget.AppBarLayout>         <android.support.v4.view.ViewPager          android:id="@+id/viewpager"          android:layout_width="match_parent"          android:layout_height="match_parent"          app:layout_behavior="@string/appbar_scrolling_view_behavior" />     </android.support.design.widget.CoordinatorLayout>

img

项目主页:http://www.open-open.com/lib/view/home/1445087021700