Transform extended FAB into standard FAB - android

Did someone already achieved to transform an extended FAB into standard FAB and vice-versa ? I know how to add a FAB into my layout and how to detect the list scroll threshold but i really don't know how to achieve this transformation (Please see the reference to see what i would like to do : Extented FAB into standard FAB).
Thank you a lot
Kind regards

Just add 2 magical lines for this behavior this code only works for ExtendedFloatingActionButton
floatingButton.shrink(); ///This line of code hide text and show Icon of floating buttion
floatingButton.extend()///This line of code show text and icon of floating button

Related

How to change bottom navigation icon color if I change Fragment programmatically

I am using bottom navigation to change fragments. For whatever reason, I need to change Fragment if the user taps a particular button. This method working fine, except a little aesthetic problem. If I change fragment programmatically, the bottom navigation icon color won't change.
For handling color change, I am using selector XML right now, but I am ready to use other solutions, to handle this little problem.
please follow this code, it may help you bottomNavigationView.setSelectedItemId(R.id.navigation_home);

floating action button stays extended on changing tab in app

I've used a FAB (Floating action button) in my app.
It stays Extended when i click on the other parts of page or changing tabs.
How can i make it embed on changing tabs or clicking on the other parts?
May be you have done mistake in your Layout XML file. Check the FAB Width & Height Property. it should be wrap_content in both.
also if you share your code we can give you proper guide.

How do I achieve this kind of layout in Android?

What is it called and what kind of library should I use so I can make one like it?
That can be created by using collapsingtoolbar layout along with FAB a.k.a Floating action button . ImageView is placed inside collapsingtoolbar.
For more information see this answer :
Collapsing toolbar with FAB

How animate icon inside floating action button

I want to create animation for my fab like this example in material design principle, I realized that icon inside fab has 2 animation. One that rotate share icon and another is alpha animation simultaneity. after that another icon replaced. but when I create animation set for this goal, whole fab rotated and disappeared, but I want that icon inside fab take this animation. How can I create this animation? thanks
The best way to achive that is create a Custom Floating action button class and Override your setImageDrawable method, doing the translation animation there. Also you can modify your onDraw method to add an animation to your FloatingActionButton
You have to use a third-party library to achieve this result. Take a look here It is important to notice that it is possible to implement your own way but you would be kind of "reinventing the wheel".
If you want to do this anyway, you can create several FABs and change visibilities and move them with simple animations.

how to put text on floating action bar (fab) in android, let the action bar be cart and text be number of items

Screenshot from Bigbasket App
I have achieved same thing by custom layout. But is there way we can put text above fab provided by android.
The FloatingActionButton extends ImageButton, which does not support text.
If you want to achieve the effect in your link using the native FloatingActionButton, you'll need to create a different icon for each digit you want to represent.
Add a textview and make it above the floating action button at centre using relative layout params and elevation attribute. You need to check for click of both I guess.
You can see this answer for elevation attribute.

Categories

Resources