How to make a Square or Rectangular FloatingActionButton?

6

I have 2 Floating Action Buttons on the screen. How can I make them rectangular?

    
asked by Henrique Mendes 27.09.2016 в 20:14

1 answer

7

One solution to make it square would be to use borderWidth inserting 0dp into its FloatingActionButton . Then it would result in this:

Code

app:borderWidth="0dp"

FloatingActionButton:

<android.support.design.widget.FloatingActionButton
        xmlns:app="http://schemas.android.com/apk/res-auto"
        app:borderWidth="0dp"
        android:id="@+id/fab_1"
        android:layout_marginBottom="16dp"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal|bottom"
        android:src="@drawable/abc_ic_clear_mtrl_alpha"/>

See the Gist code .

Image

    
27.09.2016 / 20:25