【发布时间】:2014-11-29 03:04:40
【问题描述】:
美好的一天,为令人困惑的标题道歉。
我正在创建一个 android 应用程序,我需要一个对话框/弹出窗口以显示在特定的 X Y 位置。我已经有一个可用的 DialogFragmet,如下所示:
public class ItemDialog extends DialogFragment implements OnClickListener{
//a lot of public and private variables here
public interface onSubmitListener {
void setOnSubmitListener(String qty, String disc, String instructions, UOMClass uom);
}
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
final Dialog dialog = new Dialog(getActivity());
dialog.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
LayoutInflater layoutInflater = (LayoutInflater) getActivity()
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View layout2 = layoutInflater.inflate(R.layout.fragment_item_dialog, null);
dialog.setContentView(layout2);
setStyle(DialogFragment.STYLE_NORMAL, R.style.MyDialog);
//snip snip more code
dialog.show();
//buttons - I set the buttons here
//editTexts - I set the edit texts here
//TextViews - I set the text views here
return dialog;
}
//more functions here
}
我从我的基本活动中调用它如下:
ItemDialog itemDialog = new ItemDialog();
//pass values from base activity to the ItemDialog here
itemDialog.show(getFragmentManager(), "");
但是,我需要能够在其中的编辑文本中看到基本活动和输入值。到目前为止,我的 DialogFragment 覆盖了屏幕的很大一部分,我无法看到它背后的活动。在 Dialog Fragment 外部单击也会取消它。
我搜索了如何使警报对话框浮动但无济于事。
有没有办法在屏幕的某个区域显示对话框片段以允许用户查看并仍然在基本活动中输入值?
非常感谢任何帮助,谢谢。
【问题讨论】:
标签: android android-dialogfragment dialogfragment