Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Keep Action Bar Stable during Activity Transition Animation

I am using the Action Bar in my Android application, and i am using sliding animation during activity transition, by calling:

startActivityForResult(i, ALL_OK);
overridePendingTransition(R.anim.slide_in, R.anim.slide_out);

where in my xml files i have the following code:

<set xmlns:android="http://schemas.android.com/apk/res/android"> 
 <translate android:fromXDelta="100%p" android:toXDelta="0" android:duration="400"/>  
</set>

and

<set xmlns:android="http://schemas.android.com/apk/res/android">   
 <translate android:fromXDelta="0" android:toXDelta="-100%p" android:duration="400"/>
</set>

The animation is executed successfully, but the slide also include the Action Bar.

Is there a way that the Action Bar will stay stable during the activity transition ?

like image 515
NickPro Avatar asked Jun 09 '13 21:06

NickPro


Video Answer


1 Answers

Is there a way that the Action Bar will stay stable during the activity transition ?

No, sorry. If you are switching between activities, the entire UI changes, action bar and all.

If your desired UI behavior is essential, rewrite your app to have one activity and multiple fragments, and use animations for transitioning between the fragments.

like image 198
CommonsWare Avatar answered Sep 22 '22 18:09

CommonsWare