title: Programmatically add views to LinearLayout with both gravity and weight
body: <p>I have LinearLayout generated in xml, this one:</p>
  
  <pre><code>&lt;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"/&gt;
  </code></pre>
  
  <p>I'm trying to add some custom views to this layout and place them evenly along layout:</p>
  
  <pre><code>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);
  </code></pre>
  
  <p>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.</p>
  
  <p>Could somebody point me to way of solving this problem?</p>