1.在清单文件中设置theme
<activity
android:theme="@android:style/Theme.Dialog" >
</activity>
2.在对话框中去除标题(去除标题一个要在setContentView(R.layout.activity_qxonclick)方法之前)
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// 去除title
requestWindowFeature(Window.FEATURE_NO_TITLE);
// 去掉Activity上面的状态栏
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_qxonclick);
}
3.在使用intent跳转的时候,新建一个任务
Intent intent=new Intent(context,QXOnclickActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
效果图