Skip to content

Instantly share code, notes, and snippets.

@nguyenlinhnttu
Created July 25, 2018 09:57
Show Gist options
  • Save nguyenlinhnttu/be2734e2b7c86b686d70bc5b2a6c2a21 to your computer and use it in GitHub Desktop.
Save nguyenlinhnttu/be2734e2b7c86b686d70bc5b2a6c2a21 to your computer and use it in GitHub Desktop.
use dialog full screen, with set layout param, and gravity.
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setStyle(STYLE_NO_FRAME, R.style.AppTheme);
}
@Override
public void onStart() {
super.onStart();
ViewGroup.LayoutParams params = getDialog().getWindow().getAttributes();
params.width = ViewGroup.LayoutParams.MATCH_PARENT;
params.height = ViewGroup.LayoutParams.WRAP_CONTENT;
getDialog().getWindow().setAttributes((android.view.WindowManager.LayoutParams) params);
getDialog().getWindow().setGravity(Gravity.BOTTOM);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment