Home Android Android ExtendedFloatingActionButton — fast tricks to begin utilizing it right this moment...

Android ExtendedFloatingActionButton — fast tricks to begin utilizing it right this moment | by Viktoriia.io | Nov, 2020


Viktoriia.io

https://material.io/components/buttons-floating-action-button#extended-fab

Normal information

Immediately we’re gonna have a fast dive into Materials ExtendedFloatingActionButton from https://material.io/components/buttons-floating-action-button#types-of-transitions

Good that now we have it already accomplished by Android staff 🙂

https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton

Be aware: Apparently, however ExtendedFloatingActionButton (EFAB) doesn’t lengthen FloatingActionButton (FAB) the way you would possibly already assumed. EFAB extends MaterialButton which is Button once we go deeper, whereas FAB is an ImageButton, due to this fact an ImageView. If you happen to wished to create some frequent strategies, extension features or use generics when utilizing EFAB and FAB — unhealthy information for you :(, you may solely do that with some frequent interfaces they implement, but it surely’s not the most suitable choice.

Fast begin

To make use of EFAB in your individual challenge do 3 steps:

Step 1: add dependency in construct.gradle to materials (newest model)

Step 2: regulate app theme in types.xml to one among Theme.MaterialComponents

Step 3: add EFAB in your structure.xml

Anatomy & behaviour

EFAB differs from FAB in it’s UI, it’s recommended that EFAB can haven’t solely icon, but additionally a textual content label. (but it surely’s not a should to have each as you’ll see within the examples under)

https://material.io/components/buttons-floating-action-button#extended-fab

As for the behaviour — most likely the one you’ll use more often than not is “Transformation to a regular FAB” on scrolling or resizing your app.

In my expertise it is a useful animation for scrollable screens, in case you have content material inside ScrollView otherwise you’re utilizing RecyclerView.
If you would like your button to behave precisely as in materials.io pattern, and also you’re utilizing RecyclerView, use this listener by way of addOnScrollListener to your recyclerView:



Source link

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Greatest Purchase provides $250 of rebates and extras

Yesterday we laid out the best way to save $700 on the Samsung Galaxy S21 vary if you trade-in your previous telephone with...

Apple investigating ultrasonic sensors to authenticate person voices

New analysis reveals that Apple is taking a look at the way to make Siri detect specific voices, and in addition decide their...

We’re giving freely free new wallpapers in your cellphone each week, and you may get the following one this Sunday

This story was initially printed 2020/11/05 10:40am PSTon Nov 5, 2020 and final up to date 2021/01/15 11:13am PSTon Jan 15, 2021.  Whether...

VOCOlinc Cool Mist HomeKit humidifier launches within the US

VOCOlinc's Cool Mist air humidifier has formally launched within the US, making it one of many first on this under-delivered HomeKit class. The VOCOlinc...