Skip to content

Instantly share code, notes, and snippets.

@hilfritz
Created December 5, 2018 05:57
Show Gist options
  • Save hilfritz/f4650863968427e08df9c734e76892c7 to your computer and use it in GitHub Desktop.
Save hilfritz/f4650863968427e08df9c734e76892c7 to your computer and use it in GitHub Desktop.
android: changing dialogfragment width & height
DialogFragmentClass{
@Override
public void onStart() {
super.onStart();
int width = (int)(getResources().getDisplayMetrics().widthPixels*0.95);
int height = (int)(getResources().getDisplayMetrics().heightPixels*0.30);
getDialog().getWindow().setLayout(width, ViewGroup.LayoutParams.WRAP_CONTENT);
//THIS WILL MAKE WIDTH 90% OF SCREEN
//HEIGHT WILL BE WRAP_CONTENT
//getDialog().getWindow().setLayout(width, height);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment