如何为RecyclerView的物品入口设置动画(滑入)? [英] How do I animate (slide in) a RecyclerView's item's entrance?
本文介绍了如何为RecyclerView的物品入口设置动画(滑入)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
基本上我想要类似这(在30秒标记处)的
活动开始后,我希望我的物品按顺序滑入.
I want my items to slide in sequentially once the activity starts.
我尝试了谷歌搜索.我什么也看不懂.在开发适用于Android的应用程序的疯狂世界中,我仍处在前进的道路.
I tried Googling. I found nothing that I can understand. I'm still getting my way around this crazy world of developing apps for Android.
谢谢.
推荐答案
像这样在recyclerView上添加动画
Add animation on recyclerView like this
recyclerView = (RecyclerView) findViewById(R.id.rv);
recyclerView.setHasFixedSize(true);
llm = new LinearLayoutManager(getApplicationContext());
recyclerView.setLayoutManager(llm);
AnimationSet set = new AnimationSet(true);
Animation animation = new AlphaAnimation(0.0f, 1.0f);
animation.setDuration(500);
set.addAnimation(animation);
animation = new TranslateAnimation(
Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f,
Animation.RELATIVE_TO_SELF, -1.0f, Animation.RELATIVE_TO_SELF, 0.0f
);
animation.setDuration(100);
set.addAnimation(animation);
controller = new LayoutAnimationController(set, 0.5f);
adapter = new RecycleViewAdapter(poetNameSetGets, this);
recyclerView.setLayoutAnimation(controller);
这篇关于如何为RecyclerView的物品入口设置动画(滑入)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文