Answers for "layout width and height in android studio"

1

set height of layout programmatically android

// Gets linearlayout
LinearLayout layout = findViewById(R.id.numberPadLayout);
// Gets the layout params that will allow you to resize the layout
LayoutParams params = layout.getLayoutParams();
// Changes the height and width to the specified *pixels*
params.height = 100;
params.width = 100;
layout.setLayoutParams(params);
Posted by: Guest on December-28-2020
0

how to get width android

Display display = getWindowManager().getDefaultDisplay();
Point size = new Point();
display.getSize(size);
int width = size.x;
int height = size.y;
Posted by: Guest on December-11-2020

Code answers related to "layout width and height in android studio"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language