更新时间:2022-12-26 13:45:09
你想先在 res/styles.xml 中创建一个,像这样:
You want to first create a <style>
in res/styles.xml, like this:
<style name="YourAnimation.Activity" parent="@android:style/Animation.Activity">
<item name="android:windowEnterAnimation">@anim/your_in_down</item>
<item name="android:windowExitAnimation">@anim/your_out_down</item>
</style>
然后您可以在同一个文件中将样式应用于主题:
Then you can apply the style to a theme, in the same file:
<style name="YourTheme" parent="android:Theme.Translucent">
...
<item name="android:windowAnimationStyle">@style/YourAnimation.Activity</item>
</style>
最后将主题应用于清单中的活动:
And finally apply the theme to your activities in the manifest:
<activity
android:name=".YourActivity"
android:theme="@style/YourTheme" />
查看这些链接以供参考:
Look at these links for reference: