Android FloatingActionButton edit

How to add the FAB to the layout

To use a FloatingActionButton just add the dependency in the build.gradle file as described in the remarks section.

Then add to the layout:

<android.support.design.widget.FloatingActionButton
       android:id="@+id/fab"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       android:layout_gravity="bottom|end"
       android:layout_margin="@dimen/fab_margin"
       android:src="@drawable/my_icon" />

An example:

 

Color

The background color of this view defaults to the your theme’s colorAccent.

In the above image if the src only points to + icon (by default 24x24 dp),to get the background color of full circle you can use app:backgroundTint="@color/your_colour"

If you wish to change the color in code you can use,

myFab.setBackgroundTintList(ColorStateList.valueOf(your color in int));

If you want to change FAB’s color in pressed state use

mFab.setRippleColor(your color in int);

Positioning

It is recommended to place 16dp minimum from the edge on mobile,and 24dp minimum on tablet/desktop.

Note : Once you set an src excepting to cover the full area of FloatingActionButton make sure you have the right size of that image to get the best result.

Default circle size is 56 x 56dp

 

Mini circle size : 40 x 40dp

If you only want to change only the Interior icon use a 24 x 24dp icon for default size

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:


Table Of Contents
39 ACRA
64 Menu
76 FloatingActionButton
112 Loader
119 Xposed
132 Colors
135 Fresco
140 AdMob
147 Button
156 Vk SDK
170 XMPP
176 OpenCV
200 FileIO
203 Moshi
217 Paint
231 AIDL
241 JCodec
243 Okio
255 Looper
  ↑ ↓ to navigate     ↵ to select     Esc to close