滑动表头,顶部导航栏操作

AppBarLayout:    https://www.jianshu.com/p/d159f0176576


github:       https://github.com/scwang90/SmartRefreshLayout

智能率新框架:https://blog.csdn.net/yunyu5120/article/details/74451961


滑动表头,可以将下部的布局上划,上部的隐藏,也可以在拉回来


这就是结果,上面时一个图片,用来充当表头,下面是内容,基本上时用列表视图来做的,而这个, 只需要布局就可以了

这只是使用方法,很简单,如果个人有更多需求,可以查看上面的两个链接,讲的都很详细,根据个人需求在进行更改。

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:orientation="vertical"
    tools:context="com.example.administrator.toubuguding.MainActivity">
    <!--<android.support.design.widget.CoordinatorLayout-->

<com.scwang.smartrefresh.layout.SmartRefreshLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#FFFFFF"
    >
<android.support.design.widget.CoordinatorLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent">
   <android.support.design.widget.AppBarLayout
       android:background="#FFFFFF"
       android:layout_width="match_parent"
       android:layout_height="wrap_content">
      <android.support.design.widget.CollapsingToolbarLayout
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          app:layout_scrollFlags="scroll"
          >
          <ImageView
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:src="@drawable/aa"
              />

      </android.support.design.widget.CollapsingToolbarLayout>
<TextView
    android:layout_width="match_parent"
    android:layout_height="50dp"
    android:gravity="center"
    android:text="这是留下的表头的说"
    />


   </android.support.design.widget.AppBarLayout>

    <android.support.v4.widget.NestedScrollView
        android:overScrollMode="never"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/nes_ScrollView"
        app:layout_behavior="@string/appbar_scrolling_view_behavior">
        <ImageView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:src="@drawable/bb"
            />
    </android.support.v4.widget.NestedScrollView>



</android.support.design.widget.CoordinatorLayout>
</com.scwang.smartrefresh.layout.SmartRefreshLayout>
</LinearLayout>




扫描二维码关注公众号,回复: 1488897 查看本文章

猜你喜欢

转载自blog.csdn.net/liu_ser/article/details/79724647
今日推荐