Android:自定义Dialog上面的黑框或者说是Title怎么去掉

/**
 * 电量过低,弹框提示
 */
private Dialog showBatteryLowAndFinish() {
    if(mDialog!=null){
        return mDialog;
    }
    View view = getActivity().getLayoutInflater().inflate(R.layout.dialog_low_battery, null);
    mDialog = new Dialog(getActivity());
    mDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);//这句话,就是决定上面的那个黑框,也就是dialog的title。
    mDialog.setTitle("提示");
    mDialog.setCanceledOnTouchOutside(false);
    mDialog.setContentView(view);
    mDialog.getWindow().setLayout(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
    TextView positiveButton= (TextView) view.findViewById(R.id.positiveButton);
    positiveButton.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            mDialog.dismiss();
            CameraFragment.this.getActivity().finish();
        }
    });
    TextView negativeButton= (TextView) view.findViewById(R.id.negativeButton);
    negativeButton.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            mDialog.dismiss();
        }
    });
    return  mDialog;
}

你可能感兴趣的:(Android项目功能)