当我点击图标时,我有一个带图标的列表视图 它触发了一个dailog ..我的实现如下
private void sendmessage() {
final Dialog dialog = new Dialog(getActivity(),
R.style.FullHeightDialog);
dialog.setContentView(R.layout.customdailog);
WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
lp.copyFrom(dialog.getWindow().getAttributes());
lp.width = WindowManager.LayoutParams.MATCH_PARENT;
lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
try {
final EditText edittext = (EditText) dialog
.findViewById(R.id.fbedittext);
spinner = (Spinner) dialog.findViewById(R.id.replyspinner);
Button diButton = (Button) dialog.findViewById(R.id.fbshare);
ImageView dialogcancelButton = (ImageView) dialog
.findViewById(R.id.fbreplycancel);
dialogcancelButton.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
dialog.dismiss();
getActivity().finish();
}});
diButton.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
try {
String userComment = edittext.getText().toString();
boolean postStatus=true;
postStatus=false;
}
postReply(userComment,postStatus);
getActivity().finish();
}
} } catch (Exception e) {}});
dialog.show();
dialog.getWindow().setAttributes(lp);
} catch (Exception e) {
e.printStackTrace();
getActivity().finish();
}
}
我的问题是dailog只触发一次 例如,在我第一次打开dailog后点击图标的行中 我点击取消按钮或按回按钮再次当我点击第二次dailog没有打开时, 不知道发生了什么事。任何帮助表示赞赏。
答案 0 :(得分:0)
已解决setOnCancellistener
dialog.setOnCancelListener(new OnCancelListener() {
@Override
public void onCancel(DialogInterface dialog) {
getActivity().finish();
}
} );