One.首先,设置要覆盖在最上方的dialog的view
xmlns:android=“http://schemas.android.com/apk/res/android”>
Two.然后,在values/styles.xml添加style for 半透明:
@android :color/transparent
true
true
@null
@style/Dialog_Anim
@null
Three.继续添加style for 淡入淡出效果:
@anim/fading_in
@anim/fading_out
Four.在anim文件夹下,添加文件fading_in.xml for 淡入
xmlns:android=“http://schemas.android.com/apk/res/android”>
Five.添加文件fading_out.xml for 淡出
xmlns:android=“http://schemas.android.com/apk/res/android”>
Six.最后,在要弹出对话框的地方添加如下代码:
Dialog dialog =newDialog(this, R.style.Dialog_Fullscreen);
dialog.setContentView(R.layout.sina);
ImageView iv = (ImageView)dialog.findViewById(R.id.ivNavigater_clickable);
iv.setOnClickListener(newOnClickListener() {
@Override
publicvoidonClick(View v) {
dialog.dismiss();
}
});
dialog.show();