I'm trying to animate ActionBar in my Android app. So I've wrote a animated drawable, which is used as background in ActionBar:
getActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.bad_info));
R.drawable.bad_info looks like:
<?xml version="1.0" encoding="utf-8"?>
<animation-list
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/selected"
android:oneshot="false">
<item android:duration="50">
<shape>
<gradient android:type="linear"
android:endColor="#630000"
android:startColor="#FF0202"
android:angle="270"/>
</shape>
</item>
<item android:duration="50">
<shape>
<gradient android:type="linear"
android:endColor="#3C0000"
android:startColor="#FF0202"
android:angle="90"/>
</shape>
</item>
</animation-list>
How can I "turn on" and "turn off" animation in ActionBar from code? Maybe you will give me a hint how to realize an animation by the other way.
Thanx.