androidandroid-layoutfloating-action-buttonandroid-layout-editor

Fab button with an icon showing shadow in ics (Android 4.1)


I have created this layout it works fine on Android 6.0 but in android 4.1 I am getting this weird shadow (black shadows around fab button in the picture).Following is my layout.

Following is the screen enter image description here

below xml code

   <RelativeLayout
        android:id="@+id/main_avatar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_alignParentLeft="true">
           <de.hdodenhof.circleimageview.CircleImageView
            android:id="@+id/imageview_account_profile"
            android:layout_width="80dp"
            android:layout_height="80dp"
            android:layout_alignParentTop="true"
            android:layout_centerHorizontal="true"
            android:src="@drawable/avatar_a2a"
            app:civ_border_color="@color/material_white"
            app:civ_border_width="2dp" />
           <android.support.design.widget.FloatingActionButton
            android:layout_width="30dp"
            android:layout_height="30dp"
            android:src="@drawable/ic_call"
            app:backgroundTint="@color/colorAccent"
            app:layout_anchor="@+id/imageview_account_profile"
            android:scaleType="center"
            android:layout_alignParentTop="true"
            android:layout_alignRight="@+id/imageview_account_profile"
            android:layout_marginTop="45dp"
            android:id="@+id/floatingActionButton" />
    </RelativeLayout>`

Solution

  • Add in app:elevation="0dp" to the FloatingActionButton solved my issue