Tag: android dialogfragment

无法使我的DialogFragment背景透明

我已经创建了一个自定义的DialogFragment,就像开发人员指南中所描述的那样。 现在我想做的事情听起来很简单,但我无法让它发挥作用。 我已经定义了: android:background=”@android:color/transparent”在我的布局xml中我正在加载这样的(在我的onCreateDialog中): AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); LayoutInflater inflater = getActivity().getLayoutInflater(); final View view = inflater.inflate(R.layout.pausedialog, null); setStyle(STYLE_NO_FRAME, R.style.CustomDialog); 正如您所看到的,我还尝试在DialogFragment中设置自定义样式,其定义如下: @null true true true false @null 我也试过getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(0)); 这导致空指针exception。 我正在使用android.support.v4.app.DialogFragment 。 这可能是原因吗? 或者我做错了什么? 如果您需要对话框的屏幕截图,请告诉我们! 谢谢

在DialogFragment中填充类片段时出错

我正在尝试使用其中的listview创建一个dialogfragment,并使用此问题中接受的答案来执行此操作 如何在DialogFragment中显示现有的ListFragment 但是当我尝试打开片段对话框并且应用程序崩溃时,我收到了一个Error inflating class fragment 下面是dialog_fragment_with_list_fragment布局 并且它不是导致它失败的androidxmlparsingactivity片段,我用其他片段尝试了它们并且它们也没有工作 下面是我的对话框片段类 public class BodyDialogue extends DialogFragment { int mNum; /** * Create a new instance of MyDialogFragment, providing “num” * as an argument. */ static BodyDialogue newInstance(int num) { BodyDialogue f = new BodyDialogue(); // Supply num input as an argument. Bundle args = new Bundle(); args.putInt(“num”, […]

Android警报对话框无法找到视图

我无法使用AlertDialog将文本传回给调用它的活动。 似乎问题是它在调用findViewByID时找不到合适的EditText,但我是Android的新手并且不知道为什么会这样。 代码如下: public class ModifyDialogFragment extends DialogFragment { /* The activity that creates an instance of this dialog fragment must * implement this interface in order to receive event callbacks. * Each method passes the DialogFragment in case the host needs to query it. */ public interface MDialogListener { public void onMDialogPositiveClick(String newValue); } […]