简体   繁体   English

我无法在 recyclerview 上显示浮动操作菜单

[英]I can't display floating action menu on recyclerview

I want to display floating action menu on recyclerview object.I have a lesson activity that display to saved lesson.我想在 recyclerview object 上显示浮动操作菜单。我有一个课程活动显示到已保存的课程。 I want to add floating action button its include 2 selection.我想添加浮动操作按钮,它包括 2 个选择。 When i added new dataif recylverview object is no have data my floating action menu is working good but when recyclerview is full its not working like the picture bottom of page.当我添加新数据时,如果 recylverview object 没有数据,我的浮动操作菜单运行良好,但是当 recyclerview 已满时,它不像页面底部的图片那样运行。 What can i do solved this problem?我能做些什么来解决这个问题?

<RelativeLayout 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:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_gravity="center"
    android:background="@drawable/bg_login"
    tools:context=".MainActivity">

        <com.github.clans.fab.FloatingActionMenu
            android:id="@+id/floatingActionMenu"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:layout_alignParentEnd="true"
            android:layout_alignParentRight="true"
            android:layout_margin="16dp"
            app:menu_backgroundColor="@android:color/transparent"
            app:menu_fab_label=""
            app:menu_openDirection="up"
            app:menu_showShadow="true">

            <com.github.clans.fab.FloatingActionButton
                android:id="@+id/floatingAddButtonLesson"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                app:fab_label="Ders Ekle"
                app:fab_size="mini"
                app:srcCompat="@drawable/ic_add"
                tools:ignore="VectorDrawableCompat" />

            <com.github.clans.fab.FloatingActionButton
                android:id="@+id/floatingAddButtonLesson2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                app:fab_label="Toplam Kaç Soru Çözdüm"
                app:fab_size="mini"
                app:srcCompat="@drawable/ic_add"
                tools:ignore="VectorDrawableCompat" />


        </com.github.clans.fab.FloatingActionMenu>

    <androidx.recyclerview.widget.RecyclerView
        android:layout_width="match_parent"
        android:id="@+id/rvLesson"
        android:layout_height="wrap_content"/>
</RelativeLayout>

You just need to place FloatingActionMenu below the RecyclerView , then FloatingActionMenu will show on top RecyclerView您只需将FloatingActionMenu放在RecyclerView下方,然后FloatingActionMenu将显示在RecyclerView顶部

<RelativeLayout 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:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_gravity="center"
    android:background="@drawable/bg_login"
    tools:context=".MainActivity">

        <androidx.recyclerview.widget.RecyclerView
            android:layout_width="match_parent"
            android:id="@+id/rvLesson"
            android:layout_height="wrap_content"/>

        <com.github.clans.fab.FloatingActionMenu
            android:id="@+id/floatingActionMenu"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:layout_alignParentEnd="true"
            android:layout_alignParentRight="true"
            android:layout_margin="16dp"
            app:menu_backgroundColor="@android:color/transparent"
            app:menu_fab_label=""
            app:menu_openDirection="up"
            app:menu_showShadow="true">

            <com.github.clans.fab.FloatingActionButton
                android:id="@+id/floatingAddButtonLesson"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                app:fab_label="Ders Ekle"
                app:fab_size="mini"
                app:srcCompat="@drawable/ic_add"
                tools:ignore="VectorDrawableCompat" />

            <com.github.clans.fab.FloatingActionButton
                android:id="@+id/floatingAddButtonLesson2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                app:fab_label="Toplam Kaç Soru Çözdüm"
                app:fab_size="mini"
                app:srcCompat="@drawable/ic_add"
                tools:ignore="VectorDrawableCompat" />


        </com.github.clans.fab.FloatingActionMenu>

</RelativeLayout>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM