Android 占屏幕所有宽度的DialogFragment

    @Override
    public void onStart() {
        super.onStart();
        Window window = getDialog().getWindow();
        window.setDimAmount(0);
        window.setGravity(Gravity.BOTTOM);
        window.setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.WRAP_CONTENT);
        window.requestFeature(Window.FEATURE_NO_TITLE);
        window.setBackgroundDrawableResource(android.R.color.transparent);
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle   savedInstanceState) {
        getDialog().getWindow().requestFeature(Window.FEATURE_NO_TITLE);
        View view = LayoutInflater.from(getActivity()).inflate(R.layout.layout_local_video_list,container,false);
        return view;
    }

你可能感兴趣的:(Android 占屏幕所有宽度的DialogFragment)