LottieAnimationView lottieView;
for (int i = 0; i < mTabButtons.getChildCount(); i++) {
final int index = i;
lottieView = (LottieAnimationView)mTabButtons.findViewById(mLottieViewId[index]);
// 开启硬件加速
lottieView.useHardwareAcceleration(true);
lottieView.enableMergePathsForKitKatAndAbove(true);
lottieView.setAnimation(mAnimationArray[index]);
lottieView.setProgress(0);
mTabButtons.getChildAt(index).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//onTabItemSelectedChange_NO_1(index); //无闪屏,动画播放会比页面切换慢一点
//onTabItemSelectedChange_NO_2(index); //出现闪屏
//onTabItemSelectedChange_NO_3(index); //无结束动画
onTabItemSelectedChange(index); //结束动画倒序(0.3f-0f)执行时间为500ms
logTabClick(index);
showTab(index);
}
});
}
/*// 无闪屏,有延迟
private void onTabItemSelectedChange_NO_1(int selected) {
for (int i = 0; i < mTabButtons.getChildCount(); i++) {
if (i == selected) {
final LottieAnimationView lottieView = (LottieAnimationView)mTabButtons.find
LottieAnimationView lottieView; for (int i = 0; i < mTabButtons.getChildCount(); i++) { final int index = i; lottieView = (LottieAnimationView)mTabButtons.findViewBy...