android transition

為{幸葍}努か 提交于 2019-12-06 01:06:31

Put the array of the TransitionDrawable.

List<TransitionDrawable>array = new ArrayList<TransitionDrawable>();

TransitionDrawable transition1 = (TransitionDrawable) getResources()
            .getDrawable(R.drawable.splash_animation1); // first,second image

TransitionDrawable transition2 = (TransitionDrawable) getResources()
            .getDrawable(R.drawable.splash_animation2); // third,fourth image

array.add(transition1);
array.add(transition2);
// call array
for(TransitionDrawable transition :array){
transition.start(5000);
}
 ImageView imageView= (ImageView) findViewById(R.id.splash_image);
 imageView.setImageDrawable(transition[0]); // if transition[0] is finished  setImageDrawable(transition[1]);

You can do this with any number of images.

You'll need to re-create the TransitionDrawable with the current and next item in the array and update it.

See my answer at https://stackoverflow.com/a/54584103/114549

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!