我想在recyclerview上添加浮动操作按钮,但问题是当我点击浮动操作按钮Recyclerview项目时点击如何删除此问题
见下面的代码
<RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".screens.ShowSubjectsFrag" 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.support.v7.widget.RecyclerView android:id="@+id/MainList" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_gravity="center"> </android.support.v7.widget.RecyclerView> <android.support.design.widget.FloatingActionButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@android:drawable/ic_input_add" app:layout_anchor="@id/MainList" android:layout_margin="@dimen/fab_margin" android:layout_alignParentBottom="true" android:layout_alignParentRight="true" android:layout_alignParentEnd="true" /> </RelativeLayout>
解决方法
在Activity / Fragment中为FloatingActionButton编写View#onClickListener,因为当前您的FloatingActionButton没有为任何事件注册. 有同样的问题 干杯
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。