Android L FAB Button shadow

zeTechMoy

In the Material Design guidelines Google presented a new style of button, the FAB Button. I found instructions how to make it but I have trouble adding the shadow. How can this be achieved?

yannickpulver

Check out the "activity.java", there is probably the code you need.

I made the Fab - Button like this:

layout.xml

    <Button
    style="?android:attr/buttonStyleSmall"
    android:layout_width="56dp"
    android:layout_height="56dp"
    android:text="+"
    android:textSize="40sp"
    android:background="@drawable/ripple"
    android:id="@+id/fabbutton"
    android:layout_margin="@dimen/activity_horizontal_margin"
    android:elevation="3dp"
    android:paddingBottom="16dp"
    android:fontFamily="sans-serif-light"
    android:layout_alignParentEnd="true"
    android:layout_gravity="right|bottom" />

ripple.xml

<?xml version="1.0" encoding="utf-8"?>
 <ripple android:color="#ffb300" xmlns:android="http://schemas.android.com/apk/res/android">
 <item android:drawable="@drawable/fab"></item>
</ripple>

fab.xml

<?xml version="1.0" encoding="utf-8"?>
  <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
  <solid android:color="@color/accentColor" />
</shape>

Activity.java

    import android.graphics.Outline;
    ...
    Button fab = (Button) rootView.findViewById(R.id.fabbutton);

    Outline mOutlineCircle;
    int shapeSize = getResources().getDimensionPixelSize(R.dimen.shape_size);
    mOutlineCircle = new Outline();
    mOutlineCircle.setRoundRect(0, 0, shapeSize, shapeSize, shapeSize / 2);

    fab.setOutline(mOutlineCircle);
    fab.setClipToOutline(true);

This code will be shown as error in android studio v0.8.1, so as other android l components. It will be fixed in the next version.

Result:

enter image description here

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Android L - Floating Action Button (FAB)

From Dev

Android design library FAB no shadow

From Dev

How to add shadow to the FAB provided with the android support design library?

From Dev

How to remove auto padding of FAB button in android?

From Java

How to remove button shadow (android)

From Dev

Remove shadow effect on android button

From Dev

Android elevation not showing shadow on Button

From Dev

Remove button shadow in java (Android)

From Dev

Android elevation not showing shadow on Button

From Dev

Android button shadow/margin top

From Java

CardView not showing Shadow in Android L

From Dev

How to create Shadow on Android Button (Material Design)

From Dev

Android Material Design Toolbar and FAB Button crossing over

From Dev

android: dynamically change FAB(Floating Action Button) icon from code

From Dev

How to change android design support library FAB Button border color?

From Dev

Android: material design's Floating Action Button (FAB) and shifting views

From Dev

Fab button on the center of CardView

From Dev

Android L shadow on overflow menu glitch

From Dev

Remove ActionBar shadow on Android L (API 21)

From Dev

FAB - square on pre Lollipop and without shadow on Lollipop

From Dev

How to create button shadow in android material design style

From Dev

How to achieve Android Button Animation with text-blurred and shadow

From Dev

How to get rid of shadow that appears on my button? Android

From Dev

Animate Fab Button cross to mark

From Dev

Angular Material FAB Dial button

From Dev

Add text to FAB in Android

From Dev

Android FAB transform to menu

From Java

How to create a floating action button (FAB) in android, using AppCompat v21?

From Dev

Android: How can we hide/show floating action button(fab) in xml layout

Related Related

  1. 1

    Android L - Floating Action Button (FAB)

  2. 2

    Android design library FAB no shadow

  3. 3

    How to add shadow to the FAB provided with the android support design library?

  4. 4

    How to remove auto padding of FAB button in android?

  5. 5

    How to remove button shadow (android)

  6. 6

    Remove shadow effect on android button

  7. 7

    Android elevation not showing shadow on Button

  8. 8

    Remove button shadow in java (Android)

  9. 9

    Android elevation not showing shadow on Button

  10. 10

    Android button shadow/margin top

  11. 11

    CardView not showing Shadow in Android L

  12. 12

    How to create Shadow on Android Button (Material Design)

  13. 13

    Android Material Design Toolbar and FAB Button crossing over

  14. 14

    android: dynamically change FAB(Floating Action Button) icon from code

  15. 15

    How to change android design support library FAB Button border color?

  16. 16

    Android: material design's Floating Action Button (FAB) and shifting views

  17. 17

    Fab button on the center of CardView

  18. 18

    Android L shadow on overflow menu glitch

  19. 19

    Remove ActionBar shadow on Android L (API 21)

  20. 20

    FAB - square on pre Lollipop and without shadow on Lollipop

  21. 21

    How to create button shadow in android material design style

  22. 22

    How to achieve Android Button Animation with text-blurred and shadow

  23. 23

    How to get rid of shadow that appears on my button? Android

  24. 24

    Animate Fab Button cross to mark

  25. 25

    Angular Material FAB Dial button

  26. 26

    Add text to FAB in Android

  27. 27

    Android FAB transform to menu

  28. 28

    How to create a floating action button (FAB) in android, using AppCompat v21?

  29. 29

    Android: How can we hide/show floating action button(fab) in xml layout

HotTag

Archive