I am building up a UI from code and can successfully add ProgressBar widgets, however I cannot alter the dimensions of the widget to values I need, it always stays at the de
R.layout.activity includes this:
And then the code:
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity);
ProgressBar bar = (ProgressBar)findViewById(R.id.progress);
bar.getLayoutParams().height = 500;
bar.invalidate();
}
The call to the invalidate() method is important as that is when the view is redrawn to take the changes into account. Although unintuitive, it does allow for better performance by batching changes.