Android:requestWindowFeature对话框和onResume()方法中出现错误

Android:requestWindowFeature对话框和onResume()方法中出现错误,android,dialog,onresume,Android,Dialog,Onresume,您好,我搜索了此类错误,但找不到在onResume()方法中创建自定义对话框时触发此requestFeature()错误的解决方案 我正在调用对话框.requestWindowFeature(Window.FEATURE\u NO\u TITLE)在像下面这样设置contentview之前dialog.setContentView(R.layout.fav_info_dialog) 下面是我的代码 @Override protected void onResume() { super.o

您好,我搜索了此类错误,但找不到在onResume()方法中创建自定义对话框时触发此requestFeature()错误的解决方案

我正在调用对话框.requestWindowFeature(Window.FEATURE\u NO\u TITLE)在像下面这样设置contentview之前dialog.setContentView(R.layout.fav_info_dialog)

下面是我的代码

@Override
protected void onResume() {
    super.onResume();

    supportInvalidateOptionsMenu();
    ActivityCompat.invalidateOptionsMenu(Converter.this);
    // update the title
    updateTheTittle(getResources().getString(R.string.menu_units));
    cancleBtn.setVisibility(View.GONE);
    //
    if (mSharedPref.getInt(Constants.HOME_INFO_DIALOG_STATUS, 0) == 0)
        if (mSharedPref.getInt(Constants.DASHOBOARD_TYPE,
                Constants.GridView) == 2)
            createCustomDialog();
}

private void createCustomDialog() {

    final Dialog dialog = new Dialog(this);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.setContentView(R.layout.fav_info_dialog);

    dialog.setCanceledOnTouchOutside(true);

    Button button = (Button) dialog.findViewById(R.id.desc_ok);
    button.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            SharedPreferences mSharedPref = getSharedPreferences(
                    Constants.PREFERENCE_FILENAME, Activity.MODE_PRIVATE);
            SharedPreferences.Editor editor = mSharedPref.edit();
            editor.putInt(Constants.HOME_INFO_DIALOG_STATUS, 1);
            editor.commit();
            dialog.dismiss();
        }
    });
    dialog.show();
}
请尝试以下代码:-

final Dialog dialog = new Dialog(this,android.R.style.Theme_Translucent_NoTitleBar_Fullscreen);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(R.layout.myxml);

@teekib尝试制作自己的主题。