Wednesday 1 May 2013

Android: Displaying Activities with custom animation


styles.xml
<style name="MyTheme" parent="@android:style/Theme.Panel">
    <item name="android:windowNoTitle">true</item>
    <item name="android:backgroundDimEnabled">true</item>
    <item name="android:windowAnimationStyle">@style/MyAnimation.Window</item>
</style>

<!-- Animations --> 
<style name="MyAnimation" /> 

<!-- Animations for a non-full-screen window or activity. --> 
<style name="MyAnimation.Window" parent="@android:style/Animation.Dialog"> 
    <item name="android:windowEnterAnimation">@anim/grow_from_middle</item>
    <item name="android:windowExitAnimation">@anim/shrink_to_middle</item>
</style> 
Manifest.xml
    <activity
        android:name="com.me.activity.MyActivity"
        android:label="@string/display_name"
        android:theme="@style/MyTheme">
    </activity>

No comments:

Post a Comment