android-floating-action-button icon indicating copy to clipboard operation
android-floating-action-button copied to clipboard

Cannot see floating buttons when using cardview togather.

Open llyvonne9 opened this issue 8 years ago • 0 comments

When using the CardView togather with the FloatingActionsMenu, even if I put the cardview and the floating menu in the CoordinatorLayout and 'set layout_anchor' and 'layout_anchorGravity', some floating buttons will still under the cardview and cannot be seen because of the CardView. Does anyone know why? Thanks a lot! Here is the xml code.

<android.support.v4.widget.DrawerLayout 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:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent" xmlns:fab="http://schemas.android.com/apk/res-auto" tools:openDrawer="start">

`<RelativeLayout`
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <include
        layout="@layout/app_bar_main2"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/main_include"/>


    <android.support.design.widget.CoordinatorLayout
        android:layout_height="match_parent"
        android:layout_width="match_parent"
        android:layout_below="@+id/main_include"

        >
        <android.support.v7.widget.CardView
            android:id="@+id/library_card_view"
            android:layout_height="wrap_content"
            android:layout_width="350dp"
            android:layout_centerHorizontal="true"
            android:layout_below="@+id/main_include"
            android:layout_marginTop="16dp"
            app:cardCornerRadius="10dip"
            >

            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:padding="16dp">

                <ImageView
                    android:id="@+id/library_image"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignParentLeft="true"
                    android:layout_alignParentTop="true"
                    android:src="@drawable/library"
                    android:layout_marginRight="16dp" />

                <TextView
                    android:id="@+id/library_name"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_below="@+id/library_image"
                    android:text="The library"
                    android:layout_marginTop="5dp"
                    android:textSize="30sp" />

            </RelativeLayout>

        </android.support.v7.widget.CardView>
        <com.getbase.floatingactionbutton.FloatingActionsMenu
            android:id="@+id/multiple_actions"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:layout_alignParentRight="true"
            android:layout_alignParentEnd="true"
            fab:fab_addButtonColorNormal="@color/white"
            fab:fab_addButtonColorPressed="@color/white_pressed"
            fab:fab_addButtonPlusIconColor="@color/half_black"
            fab:fab_labelStyle="@style/menu_labels_style"
            android:layout_marginBottom="16dp"
            android:layout_gravity="center_vertical"
            android:layout_marginRight="16dp"
            android:layout_marginTop="300dp"
            android:layout_marginEnd="16dp"
            app:layout_anchor="@id/library_card_view"
            app:layout_anchorGravity="bottom|right|end">

            <com.getbase.floatingactionbutton.FloatingActionButton
                android:id="@+id/borrow_book_button"
                android:layout_width="50dip"
                android:layout_height="50dip"
                fab:fab_title="@string/borrow_book"
                fab:fab_colorPressed="@color/white_pressed"
                fab:fab_colorNormal="@color/white"
                android:src="@drawable/borrow_book_pic"
                android:scaleType="centerInside"
                app:layout_anchor="@id/library_card_view"
                app:layout_anchorGravity="bottom|right|end"/>

            <com.getbase.floatingactionbutton.FloatingActionButton
                android:id="@+id/return_book_button"
                android:layout_width="50dip"
                android:layout_height="50dip"
                fab:fab_title="@string/return_book"
                fab:fab_colorNormal="@color/white"
                fab:fab_colorPressed="@color/white_pressed"
                android:src="@drawable/return_book_pic"
                android:scaleType="centerInside"
                app:layout_anchor="@id/library_card_view"
                app:layout_anchorGravity="bottom|right|end"/>

        </com.getbase.floatingactionbutton.FloatingActionsMenu>
    </android.support.design.widget.CoordinatorLayout>


</RelativeLayout>


<android.support.design.widget.NavigationView
    android:id="@+id/nav_view"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:layout_gravity="start"
    android:fitsSystemWindows="true"
    app:headerLayout="@layout/nav_header_main2"
    app:menu="@menu/activity_main2_drawer" />

</android.support.v4.widget.DrawerLayout>

llyvonne9 avatar Aug 19 '17 09:08 llyvonne9