进入:
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:duration="2000"
android:fillAfter="true"
android:fromXDelta="0"
android:fromYDelta="-100%p"
android:interpolator="@android:anim/bounce_interpolator"
android:toXDelta="0"
android:toYDelta="0"
/>
</set>
退出:
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:duration="2000"
android:fillAfter="true"
android:fromXDelta="0"
android:fromYDelta="0"
android:interpolator="@android:anim/bounce_interpolator"
android:toXDelta="0"
android:toYDelta="100%p"
/>
</set>
<resources>
<style name="dialog_style">
<item name="android:windowEnterAnimation">@anim/anim_view</item>
<item name="android:windowExitAnimation">@anim/anim_view_out</item>
</style>
</resources>
imageView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
final Dialog mDialog;
AlertDialog.Builder builder = new AlertDialog.Builder(CustomActivity.this);
builder.setTitle("bingo").setMessage("Wahaha").setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
}).create();
mDialog = builder.show();
Window win = mDialog.getWindow();
win.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);// 显示对话框时,后面的Activity不变暗,可选操作。
win.setWindowAnimations(R.style.dialog_style);
}
});
版权声明:本文为博主原创文章,未经博主允许不得转载。
原文地址:http://blog.csdn.net/pengkv/article/details/47126255