When I call toolbar.startActionMode(...) it defaultly see a fade animation, I would like to change that to a slide animation. As I can just touch the Toolbar view directly, I don't know how to do this.
I can do this by using 2 toolbars and just animate the second one. But as the Toolbar provides an action mode and I already use it, I would like to know if I somehow can modify it's animation...
Android doesn't give you access to the ActionMode "toolbar". Which by the way is not a Toolbar. The type of the context "toolbar" is ActionBarContextView.
If you want full control you need to implement your own Action Mode with 2 toolbars. Then u can add the animation you desire.
Related
I have an app, which have an action menu item on the right (2).
I need an ulterior menu in the left(1) or a button in the action bar, is that possible?
I attach a image.
enter image description here
You may create a custom toolbar. The standard height of a toolbar is 89dp.
To create a custom toolbar you should make your activity view container RelativeLayout. Then create a custom toolbar view (it may also be RelativeLayout) which height is 89dp. Then add your toolbar to the main container and set alignParentTop to true. So you have a custom flexible toolbar and you can add any view to it.
This way is very comfortable to use any custom views on your toolbar.
I also faced the same situation of customizing action bar. After a lot of searching I got the solution which is Toolbar.
Checkout: https://developer.android.com/training/appbar/setting-up
I think from now on, you should start using Toolbar as the default action bar for your apps. It provides high level of customization and material design features.
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.
I want to create sliding buttons in Android,
When we slide up the light indicator will glow, as we need change image while sliding it.
I have tried with toggle button and switch but its not having sliding effect?
Any suggestion on this.
Try to use thus library. When you will download it try to set your custom theme and get the solution.
https://github.com/pellucide/Android-Switch-Demo-pre-4.0/tree/master/
I know that I could hide and show ABS like:
getSupportActionBar().hide();
getSupportActionBar().show();
However this makes it hide and show with animation and I don't like it. I need it to hide and show immediately like if set visibility property to its view (View.VISIBLE/View.GONE/View.INVISIBLE). How could I achieve that? Or is there a way to hide()/show() without animation (show()/hide() doesn't accept any parameters)? Or is there a way to get ABS view so I could use setVisibility() on it?
No, you can not disable Actionbar show/hide animation.
I have implement bottom bar as show below I achieved this using view flipper, its work perfect but when I select any one item to start new activity, its blink because of activity change.
I want to make this bottom-bar behave like as tab in which only tab change and it wont blink activity.
Design a seperate layout with the Bottom images and their behavior (like using selector etc to change state when you click on it ) and add that layout to your Activity XML using
<include> </include> tag