0
TextSwitcherとImageSwitcherオブジェクトを使ったアンドロイドスタジオプロジェクトが既に設定されていて、完璧に(同時に)動作しています。 まず、TextSwitcherのアニメーションを先に行い、ImageSwitcherのアニメーションを2番目に(TextSwitcherアニメーションが終了した後に)したい。 AnimationListenerをTextSwitcherに追加し、AnimationListenerの 'onAnimationEnd'メソッド内のImageSwitcherのイメージを変更しようとしましたが、動作しませんでした。TextSwitcherとImageSwitcherのアニメーションの連鎖
誰にもアイデアはありますか? ご協力いただければ幸いです!
EDIT: は、アニメーションのリスナーはここで、仕事を得るためにうまく管理は、コードの抜粋です:
private void loadPosts() {
Post post = posts.get(currentPost);
//..
Animation outAnimation = AnimationUtils.loadAnimation(this, R.anim.fade_out);
outAnimation.setAnimationListener(new NextPostAnimation(post));
textSwitcher.setOutAnimation(outAnimation);
textSwitcher.setText("some text");
}
private class NextPostAnimation implements Animation.AnimationListener {
Post post;
NextPostAnimation (Post post) {
super();
this.post = post;
}
@Override
public void onAnimationStart(Animation animation) {
// TODO Auto-generated method stub
}
@Override
public void onAnimationRepeat(Animation animation) {
// TODO Auto-generated method stub
}
@Override
public void onAnimationEnd(Animation animation) {
imageSwitcher1.setImageDrawable(new BitmapDrawable(getResources(), post.image1));
}
}
はチェーンオブジェクトのアニメーションへの短い方法はありますか?
コンテキストを提供するために、あなたのコードを含めることを検討してください。参照:http://stackoverflow.com/help/mcve – SoAwesomeMan