【发布时间】:2019-07-25 08:19:53
【问题描述】:
为了能够支持底部工作表行为
我必须在RecyclerView 下方添加我的entry_field 布局。
layout_anchor 将无法正常工作。
在这种情况下,entry_field 将阻止RecyclerView。
我希望 RecyclerView 填充空格的重置并使用 entry_field 调整大小
如果entry_field 的高度发生变化,RecyclerView 应该始终适合重置的空间,而不是被entry_field 阻挡
entry_field 必须是 CoordinatorLayout 的直接子代
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="@color/background_gray_lightest">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/messaging_recycler_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipToPadding="false"
android:overScrollMode="ifContentScrolls"
android:paddingTop="8dp"
android:paddingBottom="10dp"
android:scrollbars="vertical"
android:layout_gravity="top"
tools:listitem="@layout/item_message" />
<RelativeLayout
android:id="@+id/entry_field"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
app:layout_anchor="@id/messaging_recycler_view"
app:layout_anchorGravity="bottom">
<com.abc.newmessage.NewMessageLayout
android:id="@+id/include_message_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
</com.abc.newmessage.NewMessageLayout>
</RelativeLayout>
【问题讨论】:
标签: android android-layout android-recyclerview android-coordinatorlayout