I have LinearLayout generated in xml, this one:
<LinearLayout
android:id="@+id/available_themes_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center"
android:paddingTop="6dp"
android:paddingBottom="6dp"/>
I'm trying to add some custom views to this layout and place them evenly along layout:
BiColorCircleView lightOrangeCircleView = new BiColorCircleView(getCurrentActivity());
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.WRAP_CONTENT,
LinearLayout.LayoutParams.WRAP_CONTENT,
1.0f);
params.gravity = Gravity.CENTER;
lightOrangeCircleView.setLayoutParams(params);
availableThemesLayout.addView(lightOrangeCircleView);
But at the end I achieve that only weight is applied and my views is aligned to left side. Thought, if weight is not set - gravity works nice.
Could somebody point me to way of solving this problem?