Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FloatingActionButton shadow on pre-lollipop

I want to make my FloatingActionButton much bigger with custom width and height. I find out that this is possible only if I add this as a child in FrameLayout or in CoordinatorLayout. On Lollipop and Marshmallow it looks good. But on pre-Lollipop the shadow from FloatingActionButton is very strange. Is it a bug from Android or I did something wrong?

<android.support.design.widget.CoordinatorLayout
    android:id="@+id/help_layout"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true">

    <android.support.design.widget.FloatingActionButton
        android:id="@+id/my_btn"
        android:layout_width="150dp"
        android:layout_height="150dp"
        android:layout_gravity="center"
        android:src="@mipmap/ic_launcher" />

</android.support.design.widget.CoordinatorLayout>

I also tried to add and app:borderWidth="0dp" but with no luck.

This is how it looks in Kitkat:

Kitkat

like image 507
Vasileios Pallas Avatar asked Jun 13 '16 16:06

Vasileios Pallas


1 Answers

Fab button is available under two default dimensions. Normal (56dp), Mini (40dp)

But you can override this values by adding followings code in dimens.xml (under values).

<dimen name="design_fab_size_normal">150dp</dimen>
<dimen name="design_fab_size_mini">30dp</dimen>
like image 179
Ebin Joy Avatar answered Sep 20 '22 20:09

Ebin Joy