I made the following layout programmatically:
LinearLayout progressLayout = new LinearLayout(this);
progressLayout.setOrientation(LinearLayout.VERTICAL);
TextView t = new TextView(this);
t.setText("Test..");
t.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 20);
LayoutParams l = new LayoutParams(android.view.ViewGroup.LayoutParams.WRAP_CONTENT, android.view.ViewGroup.LayoutParams.WRAP_CONTENT);
l.setMargins(10, 10, 10, 25); ===> does not work?
t.setLayoutParams(l);
ProgressBar circle = new ProgressBar(this, null,
android.R.attr.progressBarStyleLarge);
circle.setLayoutParams(new LayoutParams(android.view.ViewGroup.LayoutParams.WRAP_CONTENT, android.view.ViewGroup.LayoutParams.WRAP_CONTENT));
progressLayout.setLayoutParams(new LayoutParams(
android.view.ViewGroup.LayoutParams.FILL_PARENT,
android.view.ViewGroup.LayoutParams.FILL_PARENT));
progressLayout.setGravity(Gravity.CENTER);
progressLayout.addView(t);
progressLayout.addView(circle);
this.setContentView(progressLayout);
But no mather what I give as values in setMargins, it doesn't have any effect at all.
What is the reason?
The layout has a heigth and width of fill_parent so that can't be the problem..
Thx :)