Android设置Dialog设置圆角

dialog设置圆角

1.dialog

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
 
        getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
 
        setContentView(view);
        setCancelable(true);
    }

2.dialogfragment,必须在onCreateView里设置

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        //设置背景透明
        getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
 
        View view = View.inflate(getActivity(), R.layout.dialog_zntchain, null);
        return view;
    }

你可能感兴趣的:(Android)