DialogFragment背景颜色设置

2020-02-25  本文已影响0人  钉某人

DialogFragment背景颜色的设置两个问题
1.解决布局默认的白色边框

public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); //去除默认白色边框
        View view = inflater.inflate(R.layout.lib_base_popup_screen_shot,container,false);
.....
        return view;
    }

2.设置对话框外部遮盖层的透明度


@Override
    public void onStart() {
        // TODO Auto-generated method stub
        super.onStart();
        
        Window window = getDialog().getWindow();
        WindowManager.LayoutParams windowParams = window.getAttributes();
        windowParams.dimAmount = 0.0f;
        
        window.setAttributes(windowParams);

上一篇 下一篇

猜你喜欢

热点阅读