1

I have some Floating Action Button in my app. For all those FAB the shadow is too light. I have tried many solutions like elevation, borderwidth = 0dp, translationz, using drawable file and using styles. Those did not solve the problem and the shadow remains light.

You can check my screenshot for the light shadow that I get in my app

here

This is my xml file:

 <LinearLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:app="http://schemas.android.com/apk/res-auto"
     android:id="@+id/fabFrame"
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:layout_gravity="bottom|end"
     android:orientation="vertical">


 <LinearLayout
    android:id="@+id/layoutFabQrious"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:gravity="right"
    android:padding="8dp"
    android:orientation="horizontal"
    android:layout_marginBottom="8dp"
    android:layout_marginEnd="24dp">

    <android.support.v7.widget.CardView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:cardCornerRadius="@dimen/cardCornerRadius"
        app:cardElevation="@dimen/cardElevation"
        app:cardUseCompatPadding="true">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:paddingBottom="@dimen/cardview_vertical_padding"
            android:layout_marginTop="4dp"
            android:paddingLeft="@dimen/cardview_horizontal_padding"
            android:paddingRight="@dimen/cardview_horizontal_padding"
            android:paddingTop="@dimen/cardview_vertical_padding"
            android:text="@string/qrious"
            android:textColor="@color/colorBlack"
            android:textAppearance="?android:attr/textAppearanceSmall"
            android:textStyle="bold"
            android:background="@drawable/fab_border"/>
    </android.support.v7.widget.CardView>

    <android.support.design.widget.FloatingActionButton
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:elevation="6dp"
        android:layout_margin="8dp"
        app:borderWidth="0dp"
        android:src="@drawable/ic_qrious_24x24"
        app:backgroundTint="@color/colorFab"
        app:fabSize="mini" />

</LinearLayout>

<android.support.design.widget.FloatingActionButton
    android:id="@+id/fab"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="end"
    android:layout_marginBottom="16dp"
    android:layout_marginEnd="20dp"
    app:backgroundTint="@color/colorFab"
    android:padding="4dp"
    app:borderWidth="0dp"
    app:elevation="6dp"
    app:fabSize="normal"
    app:translationZ="12dp" />

 </LinearLayout>

This is the manifest:

 <application
    android:name=".application.AtgApplication"
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:supportsRtl="true"
    android:theme="@style/AppTheme"
    android:usesCleartextTraffic="true">

    <activity
        android:name=".activity.MainActivity"
        android:label="@string/app_name"
        android:screenOrientation="portrait"
        android:theme="@style/AppTheme.NoActionBar"
        android:windowSoftInputMode="adjustPan|adjustResize" />

 </application>

Why is the shadow light and how can I resolve this?

Thanks in advance.

Siva Perumal
  • 457
  • 2
  • 8
  • 23
  • try this: https://stackoverflow.com/questions/46299680/floating-action-button-no-shadow-showing – joao86 Feb 22 '19 at 15:22
  • I have tried deleting the hardwareaccelerated and large heap from my manifest and tried giving the borderwidth = 0dp, but still the issue is not resolved I have the same light shadow. – Siva Perumal Feb 22 '19 at 15:27

0 Answers0