-
Notifications
You must be signed in to change notification settings - Fork 27
Item: Animation
三木思 edited this page Nov 6, 2018
·
4 revisions
When use
TimoMenu.addRow(ItemAnimation itemAnimation, List<TimoItemViewParameter> timoItemViewParameters)or
TimoMenu.Builder.addRow(ItemAnimation itemAnimation, List<TimoItemViewParameter> timoItemViewParameters)You need to pass an itemAnimation parameter, it define a base class that allows you to customize the opening animation of the item.
public abstract class ItemAnimation {
/**
* Get the animation when the menu is showing.
*
* @param itemView The item view.
* @param positionOfVisibleViews The position in all visible views of the row.
* @return The animation that executed when the item view is displayed.
* */
public abstract Animation getAnimation(TimoItemView itemView, int positionOfVisibleViews);
/**
* Get the animator when the menu is showing.
*
* @param itemView The item view.
* @param positionOfVisibleViews The position in all visible views of the row.
* @return The animation that executed when the item view is displayed.
* */
public abstract Animator getAnimator(TimoItemView itemView, int positionOfVisibleViews);
}In this base class, you can specify whether to use Animation or Animator.
I have defined 8 animations in this library including reference daimajia/AndroidViewAnimations.
- FlipItemAnimation
- ScaleItemAnimation
- BombItemAnimation
- StandUpItemAnimation
- BounceItemAnimation
- BounceInDownItemAnimation
- BounceInUpItemAnimation
- RotateItemAnimation
You can refer to the below picture:

About the parameter 'positionOfVisibleViews', let's look at the below picture

In the row of menu, there are 6 items, but only 4 are visible, item2, item3, item4, item5.
So the position of visible views representative:
- item2 : position = 0
- item3 : position = 1
- item4 : position = 2
- item5 : position = 3
English
Menu
Item
中文
Menu
Item