I followed Google's standard Android SDK tutorial and have come to the point where I can change the action bar's options.
When opening a different activity, it pops in (fade-in + grow) as an animation. My problem is that the new action bar inside this activity pops in too together with the animation (it is all connected as one container) I want the action bar to persist on the top, fixed, while only the app's contents pop in. When the action bar's content changes, it should just change without any animation. As an example, look at the Telegram app.
As I followed the standard tutorial, I guess this is the default behavior so it is probably common to turn it off, yet I haven't found a working solution to this anywhere so I must be overlooking some very basic setting.
themes.xml:
...
<style name="BlaTheme"
parent="@style/Theme.AppCompat">
<item name="android:actionBarStyle">@style/MyActionBar</item>
<item name="android:actionBarTabTextStyle">@style/MyActionBarTabText</item>
<item name="android:actionMenuTextColor">@color/actionbar_text</item>
<item name="android:background">@color/darkpurple</item>
<!-- Support library compatibility -->
<item name="actionBarStyle">@style/MyActionBar</item>
<item name="actionBarTabTextStyle">@style/MyActionBarTabText</item>
<item name="actionMenuTextColor">@color/actionbar_text</item>
<item name="android:windowActionBar">true</item>
<item name="android:windowContentOverlay">@null</item>
</style>
<!-- ActionBar styles -->
<style name="MyActionBar"
parent="@style/Widget.AppCompat.ActionBar">
<item name="android:background">@android:color/transparent</item>
<item name="android:titleTextStyle">@style/MyActionBarTitleText</item>
<!-- Support library compatibility -->
<item name="titleTextStyle">@style/MyActionBarTitleText</item>
</style>
...
You can define your transitions like this :
In fade.xml file :
<?xml version="1.0" encoding="utf-8"?>
<transitionSet xmlns:android="http://schemas.android.com/apk/res/android">
<fade android:duration="500">
<targets>
<!--excluding status bar-->
<target android:excludeId="@android:id/statusBarBackground"/>
<!--excluding navigation bar-->
<target android:excludeId="@android:id/navigationBarBackground"/>
<!--excluding toolbar bar-->
<target android:excludeId="@id/toolbar"
</targets>
</fade>
</transitionSet>
and then set it as :
Transition mFadeTransition =
TransitionInflater.from(this).
inflateTransition(R.transition.fade);
getWindow().setEnterTransition(mFadeTransition);
Or using java only :
Fade fade = new Fade();
fade.setDuration(500);
//exclude toolbar
fade.excludeTarget(R.id.toolbar, true);
//exclude status bar
fade.excludeTarget(android.R.id.statusBarBackground, true);
//exclude navigation bar
fade.excludeTarget(android.R.id.navigationBarBackground, true);
getWindow().setEnterTransition(fade);