overridePendingTransition は 2 つのアニメーションを取り、画面全体をアニメーション化します。
2 つの別々のビューをアニメーション化する 2 つのアクティビティ間をどのように移行しますか?
基本的に、ボタンを押すと両開きドアが開き、開いている間に次のアクティビティが表示されます。
これで、画面を次の画面に簡単にスライドできます。
overridePendingTransition(R.anim.transition_left_in, R.anim.transition_left_out);
そして、私は両開きドアを開くことができますが、次のようなトランジションはありません:
public void loginOnClick(View view)
{
final RelativeLayout leftPanel = (RelativeLayout)findViewById(R.id.RelativeLayoutLeft);
final RelativeLayout rightPanel = (RelativeLayout)findViewById(R.id.RelativeLayoutRight);
Animation animLeft = new TranslateAnimation(1, 0, 1, -1, 1, 0, 1, 0);
animLeft.setDuration(1000);
animLeft.setFillAfter(true);
animLeft.setAnimationListener(new Animation.AnimationListener()
{
@Override public void onAnimationStart(Animation animation)
{
}
@Override public void onAnimationEnd(Animation animation)
{
leftPanel.setVisibility(View.GONE);
rightPanel.setVisibility(View.GONE);
}
@Override public void onAnimationRepeat(Animation animation)
{
}
});
Animation animRight = new TranslateAnimation(1, 0, 1, 1, 1, 0, 1, 0);
animRight.setDuration(1000);
animRight.setFillAfter(true);
leftPanel.startAnimation(animLeft);
rightPanel.startAnimation(animRight);
}
アニメーションの後にアクティビティを変更できることはわかっていますが、前のアクティビティをアニメーション化しながら次のアクティビティを見たいと思っています。
どうすればいいですか?
任意の助けをいただければ幸いです。
編集:
私が見つけた最善の回避策はinclude
、最初のアクティビティ xml で を使用して、2 番目のアクティビティのコンテキストを含めることです。onCreate()
(開くドアの後ろ)しかし、2番目の方法の後にUIのいくつかの変更があるため、それはまさに私が望むものではありません。