Android

DialogFragment Fullscreen

그란. 2019. 7. 3. 21:36

여백까지도 없애버리는 FullScreen

@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setStyle(DialogFragment.STYLE_NORMAL, android.R.style.Theme_Black_NoTitleBar_Fullscreen);
        getActivity().getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    } 

  @Override
    public void onResume() {
        super.onResume();
        Point size = new Point();
        ((WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getRealSize(size);

        getDialog().getWindow().setGravity(Gravity.LEFT | Gravity.TOP);
        getDialog().getWindow().setLayout(size.x, size.y);
    }

'Android' 카테고리의 다른 글

Android gitignore  (0) 2020.04.17
Rx onError에서 responseMessage의 필드값 가져오기  (0) 2020.04.09
RxJava 소스 모음  (0) 2019.06.15
Room Library  (0) 2019.05.21
showToast : Toast Custom  (0) 2019.04.19