Psy*_*her 29 android android-layout recycler-adapter android-recyclerview
我正在尝试使用recyclerview和浮动操作按钮来创建应用程序.我遇到的问题是浮动操作按钮阻碍了recyclerview中的按钮.我查看了Android应用程序如手机应用程序(你在gridvew中显示的联系人)是如何设计来处理这个问题的,我看到底部留有空白空间,在recyclelerview和浮动操作按钮之间留出空间,用户只需滚动到底部以避免重叠.我尝试在recyclelerview之后添加一个视图,但不会显示它,此视图也应该与recyclerview行一起移动.在Recyclerview的最后,我缺少什么来显示视图.我的布局文件:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#6fbababa">
<android.support.v7.widget.RecyclerView
android:id="@+id/my_recycler_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="vertical"/>
<ImageButton
android:id="@+id/button_floating_action"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:src="@drawable/ic_fab"
android:background="@null"
android:layout_alignParentBottom="true"
android:layout_marginBottom="12dp"
android:layout_marginEnd="12dp"
android:layout_marginRight="12dp"
android:elevation="2dp"/>
<View
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_below="@id/my_recycler_view"
android:background="@color/white"/>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

更新:修改布局代码以使其工作.
<android.support.v7.widget.RecyclerView
android:id="@+id/my_recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:paddingBottom="30dp"
android:scrollbars="vertical"/>
Run Code Online (Sandbox Code Playgroud)
yig*_*git 45
将底部填充添加到RecyclerView.此外,android:layout_height="wrap_content"除非您onMeasure在布局管理器中重写,否则请勿使用.当前布局管理器尚不支持包装内容.
添加属性android:clipToPadding="false"以实现目标.如评论中所述.
| 归档时间: |
|
| 查看次数: |
11372 次 |
| 最近记录: |