我也不知道是不是叫这个名字,希望大神指点,就是下拉时出现上划时移动隐藏,好多app都有,谢谢
http://www.jianshu.com/p/1078568e859f?utm_source=jianliao.com
外层用 CoordinatorLayout,内部嵌套 Toolbar。
具体可以参考这篇博客:http://blog.csdn.net/u010687392/article/details/46852565
外层CoordinatorLayout 里层AppbarLayout 然后Toolbar
<FrameLayout 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:background="@color/primary">
<android.support.v4.widget.DrawerLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/drawer_layout">
<android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay"
app:elevation="0dp">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:minHeight="?attr/actionBarSize"
app:layout_scrollFlags="scroll|enterAlways" />
<android.support.design.widget.TabLayout
android:id="@+id/layout_tab"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tabIndicatorColor="#33000000"
app:tabIndicatorHeight="4dp"
app:tabPaddingBottom="0dp"
app:tabPaddingEnd="0dp"
app:tabPaddingStart="0dp"
app:tabPaddingTop="0dp"
app:tabSelectedTextColor="#fff"
app:tabGravity="fill"
app:tabTextColor="#fff" />
</android.support.design.widget.AppBarLayout>
</android.support.design.widget.CoordinatorLayout>
<fragment
android:name="com..app.fragment.MineFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="start" />
</android.support.v4.widget.DrawerLayout>
<fragment
android:layout_width="match_parent"
android:layout_height="match_parent"
android:name="com..app.fragment.SplashFragment"
android:id="@+id/splash_fragment" />
</FrameLayout>
(没有比贴SegmentFault for Android
源码更有诚意的了吧?
v7的toolbar