1 dialog 对话框出现和消失 使用的方法
<span style="white-space:pre"> </span>final Dialog dialog = new Dialog(this); dialog.show(); Window window = dialog.getWindow(); WindowManager.LayoutParams lp = window.getAttributes(); window.setContentView(R.layout.dialog); lp.windowAnimations = R.style.customstyle; window.setAttributes(lp);
styles中
<style name="customstyle">
<item name="@android:windowEnterAnimation">@anim/in</item>
<item name="@android:windowExitAnimation">@anim/out</item>
</style>
2 activity 的跳转的样式更改
<style name="customstyle_activity" parent="android:Theme.NoTitleBar">
<item name="android:windowAnimationStyle">@style/fade</item>
</style>
<style name="fade" parent="@android:style/Animation.Activity">
<item name="android:activityOpenEnterAnimation">@anim/in</item>
<item name="android:activityOpenExitAnimation">@anim/out</item>
<item name="android:activityCloseEnterAnimation">@anim/in</item>
<item name="android:activityCloseExitAnimation">@anim/out</item>
</style>
主要是记住这六个 属性。。
代码下载
http://download.csdn.net/detail/wanghao200906/8193213
时间: 2024-10-10 04:37:20