I’m working on a sort of progress screen but I’m having trouble with the appearances.
Here is my code:
LinearLayout progressLayout = new LinearLayout(this);
progressLayout.setOrientation(LinearLayout.VERTICAL);
progressLayout.setGravity(Gravity.CENTER);
LayoutParams layoutParams = new LayoutParams(
android.view.ViewGroup.LayoutParams.FILL_PARENT,
android.view.ViewGroup.LayoutParams.FILL_PARENT);
progressLayout.setLayoutParams(layoutParams);
LayoutParams titelParams = new LayoutParams(android.view.ViewGroup.LayoutParams.WRAP_CONTENT, android.view.ViewGroup.LayoutParams.WRAP_CONTENT);
titelParams.setMargins(0, 0, 0, pixelsToDIP(15));
TextView t = new TextView(this);
t.setText("Zorgdossier wordt geladen");
t.setTextAppearance(this, android.R.attr.textAppearanceLarge);
t.setLayoutParams(titelParams);
ProgressBar circle = new ProgressBar(this);
circle.setScrollBarStyle(android.R.attr.progressBarStyleLarge);
circle.setLayoutParams(new LayoutParams(android.view.ViewGroup.LayoutParams.WRAP_CONTENT, android.view.ViewGroup.LayoutParams.WRAP_CONTENT));
progressLayout.addView(t);
progressLayout.addView(circle);
this.setContentView(progressLayout);
}
private int pixelsToDIP(int pixel) {
float pixels = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
pixel, this.getResources().getDisplayMetrics());
return (int) pixels;
}
I set the style of the progress and textview to large but they display really small.
Any ideas?
You’re using the wrong function.
In fact you set the style in the constructor.