android - Recycleview in coordinatorlayout -
i trying create relativelayout has coordinatorlayout , linearlayout @ bottom , found strange behavior can't resolve. layout
<?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:layout_width="match_parent" android:layout_height="match_parent"> <android.support.design.widget.coordinatorlayout android:id="@+id/content" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_above="@+id/sender" android:background="@android:color/white" android:fitssystemwindows="true"> <android.support.design.widget.appbarlayout android:id="@+id/appbar" android:layout_width="match_parent" android:layout_height="wrap_content"> <android.support.v7.widget.toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?actionbarsize" android:background="?colorprimary" app:layout_scrollflags="scroll|enteralways" /> </android.support.design.widget.appbarlayout> <android.support.v7.widget.recyclerview android:id="@+id/messages_list" android:layout_width="match_parent" android:layout_height="match_parent" app:layout_behavior="@string/appbar_scrolling_view_behavior" /> </android.support.design.widget.coordinatorlayout> <linearlayout android:id="@+id/sender" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignparentbottom="true" android:gravity="center_vertical" android:background="@android:color/white"> <edittext android:id="@+id/inputtext" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:inputtype="text" /> <button android:fontfamily="sans-serif" style="?android:attr/borderlessbuttonstyle" android:textappearance="?android:textappearancebutton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/send" android:textcolor="?colorprimary" android:id="@+id/send"/> </linearlayout> </relativelayout>
after changing data in adapter trying scroll last element ( example recyclerview.smoothscrolltoposition(size); )and see part of last view (not full size). if recycleview not nest coordinatorlayout - works expecting - see full sized last element view. how can change layout works correctly ?
in code remove app:layout_scrollflags="scroll|enteralways"
toolbar
, instead add appbarlayout
should this
<android.support.design.widget.appbarlayout android:id="@+id/appbar" android:layout_width="match_parent" android:layout_height="wrap_content" app:layout_scrollflags="scroll|enteralways"> <android.support.v7.widget.toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?actionbarsize" android:background="?colorprimary"/> </android.support.design.widget.appbarlayout>
Comments
Post a Comment