java android set view width programmatically site:stackoverflow.com code example
Example: how to set view width programmatically in android
View view = findViewById(R.id.nutrition_bar_filled);
LayoutParams layoutParams = view.getLayoutParams();
layoutParams.width = newWidth;
view.setLayoutParams(layoutParams);