当前位置: 动力学知识库 > 问答 > 编程问答 >

android - Make the navigation bar stay on top of any activity animation

问题描述:

First of all I'm working with the Android-L preview. Now, For anyone to not to misunderstand what navigation bar is, here's a pic of it:

https://imageshack.com/i/f0bjjDnQp

I'm applying the activity animation that follows:

activity.startActivity(intent);

activity.overridePendingTransition(R.anim.slide_in_from_bottom, R.anim.scale_in);

Where R.anim.slide_in_from_bottom.xml is:

<?xml version="1.0" encoding="utf-8"?>

<set xmlns:android="http://schemas.android.com/apk/res/android">

<translate

android:duration="300"

android:fromYDelta="100%"

android:toYDelta="0%"/>

</set>

and R.anim.scale_in is:

<?xml version="1.0" encoding="utf-8"?>

<set xmlns:android="http://schemas.android.com/apk/res/android">

<scale

android:duration="300"

android:fromXScale="1.0"

android:fromYScale="1.0"

android:pivotX="50%"

android:pivotY="50%"

android:toXScale="0.9"

android:toYScale="0.9"/>

<alpha

android:duration="300"

android:fromAlpha="1.0"

android:interpolator="@android:anim/accelerate_interpolator"

android:toAlpha="0.1"/>

</set>

The animation works fine except for the fact that the new activity does the animation on top of the navigation bar, I'd like it to be the opposite. Also I can see the black status bar during the whole animation which I would like to avoid too.

UPDATE:

So I found what the problem is. With the introduction of Android L preview we have the option to set this Material theme, and that theme makes the animations between activities this way. If I set android:Theme.Holo.Light for instance, everything works fine. As soon as I add this Material theme I got this ugly effect of overlaying the Navigation Bar.

So I thought I could try to find the right parameter in the Material Theme to make it behave as the old theme but I can't manage to figure it out. I've tried setting this line below, but it doesn't work either.

<item name="android:windowActionBarOverlay" >false</item>

分享给朋友:
您可能感兴趣的文章:
随机阅读: