Android实现上滑固定 下滑显示效果

<?xml version="1.0" encoding="utf-8"?>

<android.support.design.widget.CoordinatorLayout
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@android:color/background_light"
    >

    <android.support.design.widget.AppBarLayout
        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:contentScrim="@color/white"
            app:layout_scrollFlags="scroll|exitUntilCollapsed"
            app:title="@string/app_name">

            <LinearLayout
                android:focusable="true"
                android:focusableInTouchMode="true"
                android:background="@color/cf0f0f0"
                android:orientation="horizontal"
                android:layout_width="match_parent"
                android:layout_height="50dp">

                <LinearLayout
                    android:orientation="horizontal"
                    android:layout_weight="0.8"
                    android:layout_margin="4dp"
                    android:background="@color/white"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent">
                    <ImageView
                        android:src="@mipmap/sousuo"
                        android:layout_gravity="center_vertical"
                        android:layout_marginLeft="10dp"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content" />
                    <EditText
                        android:id="@+id/edit_tv"
                        android:layout_marginLeft="10dp"
                        android:hint="请输入搜索内容"
                        android:textColor="@color/tab_text_color_normal"
                        android:gravity="left|center_vertical"
                        android:background="@color/white"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent" />
                </LinearLayout>

                <Button
                    android:id="@+id/search_btn"
                    android:text="搜索"
                    android:textColor="@color/white"
                    android:background="@color/green_btn_press"
                    android:layout_marginRight="4dp"
                    android:layout_marginTop="4dp"
                    android:layout_marginBottom="4dp"
                    android:layout_width="80dp"
                    android:layout_height="match_parent" />
            </LinearLayout>
        </android.support.design.widget.CollapsingToolbarLayout>
        <android.support.design.widget.TabLayout
            android:id="@+id/tablayout"
            app:tabSelectedTextColor="@color/green_btn_press"
            app:tabTextColor="@color/tab_text_color_normal"
            android:layout_width="match_parent"
            android:layout_height="50dp"/>

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

    <android.support.v4.view.ViewPager
        android:id="@+id/vp_content"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior">

    </android.support.v4.view.ViewPager>


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


©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容