开发者

Android No Animation When Transitioning From a Portrait Activity to a Landscape Activity

开发者 https://www.devze.com 2023-03-14 01:18 出处:网络
I have Activity A which is set to run in portrait orientation (android:screenOrientation=\"portrait\" set on this activity in the manifest). This activity opens to Activity B on a button click. Activi

I have Activity A which is set to run in portrait orientation (android:screenOrientation="portrait" set on this activity in the manifest). This activity opens to Activity B on a button click. Activity B is set to run in landscape orientation (android:screenOrientation="landscape" set on this activity in the manifest). Regardless of what I set in my overridePendingTransition method, there is never an animation. It's always a hard cut. Is there a way to force some sort of animation when transitioning from Act开发者_StackOverflow社区ivity A to Activity B?

Also, I get the same issue when transitioning back from Activity B to Activity A.

Edit (from Praveen):

Even i have decalred the configChanges="orientation" in the Manifest. Still i am facing this Problem?? Any Idea on this???

Thanks in advance


i think you have to override activity's onConfigurationChange method. perhaps this will help you.

for example

@Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig);

    updateGui();
}


You can use this after you run startActivity() :

overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号