继承FragmentDialog出现灰色背景色

@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState)
	{
		// TODO Auto-generated method stub
		View view  = LayoutInflater.from(getActivity()).inflate(R.layout.customer_dialog, null);
		Bundle bundle = getArguments();
		title    = bundle.getString("replaceTip");
		sureText = bundle.getString("sureText");
		cancleText=bundle.getString("cancleText");
		headTitle = bundle.getString("headTitle");
		init(view);
		return view;
	}

当采用该种方式的时候,显示到某些手机上会出现在View的后面有一层深色的背景色,解决办法如下:

public Dialog onCreateDialog(Bundle savedInstanceState) {  
	    final Dialog dialog = new Dialog(getActivity(), R.style.dialog); 
		View view  = LayoutInflater.from(getActivity()).inflate(R.layout.customer_dialog, null);
		Bundle bundle = getArguments();
		title    = bundle.getString("replaceTip");
		sureText = bundle.getString("sureText");
		cancleText=bundle.getString("cancleText");
		headTitle = bundle.getString("headTitle");
		init(view);
		dialog.setContentView(view);
		return dialog;
	}

这样既可。

你可能感兴趣的:(android,手机)