这个是我最终实现的效果是用
CoordinatorLayout 这个来实现的 现在的问题是
下面的添加联系人控件怎么固定
<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: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="350dp"
android:fitsSystemWindows="true"
>
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/CollapsingToolbarLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:contentScrim="@color/new_back_color"
app:expandedTitleMarginEnd="64dp"
app:expandedTitleMarginStart="48dp"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<RelativeLayout android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@mipmap/neigh_bac"
app:layout_collapseMode="parallax"
app:layout_collapseParallaxMultiplier="0.5">
<com.jingxi.smartlife.user.view.RoundImageView
android:id="@+id/user_avatar"
style="@style/user_avatar"
android:layout_width="65dp"
android:layout_height="65dp"
android:layout_marginTop="55dp"
android:background="@null"
app:aiv_ShowBoarder="false"
app:aiv_TextSizeRatio="0.4"
/>
<TextView
android:id="@+id/user_name"
style="@style/user_name"
android:layout_below="@+id/user_avatar"
android:layout_marginTop="5dp"
android:text="爸爸"
android:textColor="@android:color/black"/>
<TextView android:id="@+id/neighInfo" android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/user_name"
android:layout_centerHorizontal="true"
android:layout_marginTop="15dp"
android:textColor="@android:color/black"
/>
</RelativeLayout>
<android.support.v7.widget.Toolbar android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="50dp"
app:contentInsetStart="0dp"
app:layout_collapseMode="pin"
>
<ImageView
android:id="@+id/back"
style="@style/wrap_match"
android:layout_marginStart="10dp"
android:contentDescription="@string/img_icon"
android:minWidth="25dp"
android:src="@mipmap/ic_arrow_w"/>
<ImageView
android:id="@+id/back2"
style="@style/wrap_match"
android:layout_gravity="right"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:contentDescription="@string/img_icon"
android:minWidth="25dp"
android:src="@mipmap/myneigh_more"/>
</android.support.v7.widget.Toolbar>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v7.widget.RecyclerView
android:id="@+id/recycle_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
/>
<RelativeLayout android:id="@+id/bottom_tool"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true">
<TextView android:id="@+id/bot_text" android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:gravity="center"
android:minHeight="40dp"
android:textColor="@android:color/black"
tools:text="添加联系人"
/>
<ImageView android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginEnd="10dp"
android:layout_toStartOf="@+id/bot_text"
android:contentDescription="@string/aboutSmart"
android:src="@mipmap/head_friendsadd"
/>
</RelativeLayout>
</android.support.design.widget.CoordinatorLayout>
这是我的布局代码
供参考:底部的添加联系人从CoordinatorLayout中拿出来,放到一个framelayout中和CoordinatorLayout并列: