Click here to Skip to main content
15,868,016 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
//screen size
int screenHeight = getScreenSize();
ViewGroup.LayoutParams params = mBinding.layDetailsPopupComplete.getLayoutParams();

int layoutHeight = mBinding.layDetailsPopupComplete.getMeasuredHeight();

params.width = ViewGroup.LayoutParams.MATCH_PARENT;
if (layoutHeight >= screenHeight || layoutHeight == 0) {
params.height = screenHeight;
} else {
params.height = ViewGroup.LayoutParams.WRAP_CONTENT;
}

What I have tried:

public int getScreenSize(){
DisplayMetrics displayMetrics = new DisplayMetrics();
getActivity().getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
int height = displayMetrics.heightPixels;
int width = displayMetrics.widthPixels;
return (int) (height * 0.7);
}
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900