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;
    }
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章