I want to do that when BottomSheet would appear on the screen, so that it would rise and View along with it, for this I use CoordinatorLayout and Anchor , the problem is that the BottomSheet rises, and View remains below:
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:emojicon="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="56dp" android:background="@color/colorMain" android:titleTextColor="@color/colorWhite" android:layout_gravity="top" app:subtitleTextColor="@color/colorWhite" app:theme="@style/ToolbarTheme"></android.support.v7.widget.Toolbar> <android.support.v7.widget.RecyclerView android:id="@+id/rvChat" android:layout_marginTop="?attr/actionBarSize" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_above="@+id/rvWriteMessage" android:layout_below="@+id/toolbar" android:background="@color/colorWhite"></android.support.v7.widget.RecyclerView> <!-- include bottom sheet --> <include layout="@layout/bottom_sheet" /> <RelativeLayout android:id="@+id/rvWriteMessage" android:layout_width="match_parent" android:layout_height="wrap_content" app:layout_anchor="@+id/llBottomSheet" app:layout_anchorGravity="top|end" android:layout_above="@+id/rvIcons" android:layout_marginLeft="5dp"> <!--android:layout_gravity="end|bottom"--> <View android:layout_width="match_parent" android:layout_height="0.5dp" android:layout_above="@+id/rvInside" android:background="@color/colorGreyTransparent" /> <RelativeLayout android:id="@+id/rvInside" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_marginBottom="3dp" android:layout_marginRight="2dp" android:background="@color/colorWhite" > <ImageView android:id="@+id/imgSticker" android:layout_width="36dp" android:layout_height="36dp" android:layout_alignParentLeft="true" android:layout_centerVertical="true" android:background="@drawable/ic_tag_faces_24dp" /> <io.github.rockerhieu.emojicon.EmojiconEditText android:id="@+id/etMessage" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_centerVertical="true" android:layout_marginLeft="50dp" android:layout_marginRight="5dp" android:layout_toLeftOf="@+id/imgCamera" android:background="@drawable/rectangle_edit_text" android:hint="@string/conversation_activity_hint" android:textCursorDrawable="@color/colorMain" emojicon:emojiconSize="32sp" /> <ImageView android:id="@+id/imgCamera" android:layout_width="36dp" android:layout_height="36dp" android:layout_centerVertical="true" android:layout_margin="5dp" android:layout_toLeftOf="@+id/btnSend" android:background="@drawable/circle_button" android:padding="7dp" android:src="@drawable/ic_add" /> <ImageView android:id="@+id/btnSend" android:layout_width="36dp" android:layout_height="36dp" android:layout_alignParentRight="true" android:layout_centerVertical="true" android:layout_margin="5dp" android:background="@drawable/button_rectangle" android:padding="7dp" android:src="@drawable/ic_send" /> </RelativeLayout> </RelativeLayout> Layout for BottomSheet :
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/llBottomSheet" android:layout_width="match_parent" android:layout_height="200dp" android:background="@android:color/darker_gray" android:orientation="vertical" app:behavior_hideable="true" app:behavior_peekHeight="200dp" app:layout_behavior="android.support.design.widget.BottomSheetBehavior"> <TextView android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center" android:layout_alignParentBottom="true" android:text="Bottom sheet content" android:textColor="@android:color/white" /> </RelativeLayout> What happens when you raise the BottomSheet (rvWriteMessage remains at the bottom of the screen):
