view = LayoutInflater.from(getActivity()).inflate(
R.layout.dialog_tips, null);
title2 = (TextView) view.findViewById(R.id.title2);
dialog = new Dialog(getActivity());
dialog.setOnKeyListener(new OnKeyListener() {
@Override
public boolean onKey(DialogInterface dialog,
int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK
&& event.getRepeatCount() == 0) {
getActivity().finish();
}
return false;
}
});
dialog.getWindow().setBackgroundDrawable(
new ColorDrawable(
android.R.color.transparent));
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(view);
dialog.getWindow()
.setLayout(
ScreenUtil
.getScreenWidth(getActivity()) - 50,
DensityUtil.dp2px(400));
dialog.show();