title: Adding the below layout code dynamically in android activity
body: <p>I have implemented a layout statically in Android layouts folder xml file which is as follows </p>
  
  <pre><code>            &lt;TableRow
                  android:layout_height="wrap_content"
                  android:layout_width="match_parent"
                  &gt;
                  &lt;LinearLayout
                      android:weightSum="1.0"
                      android:layout_weight=".75"
                      android:layout_height="match_parent"
                      android:layout_width="0dip"
                      android:background="#ffef1128"
                      &gt;
  
  
                      &lt;Button
                          android:id="@+id/textbox12"
                          android:layout_height="wrap_content"
                          android:layout_weight="0.2"
                          android:layout_width="0dip"
                          android:textSize="14sp"
                          android:text="20%"
                          android:background="@color/fund_background_blue"
                          android:textColor="@color/gen_text_color"
                           /&gt;
                       &lt;/LinearLayout&gt;
  
                  &lt;LinearLayout
                      android:layout_weight=".25"
                      android:layout_height="match_parent"
                      android:layout_width="0dip"
                      &gt;
  
  
                      &lt;TextView
                          android:id="@+id/TextView22"
                          android:text="12.4"
                          android:layout_weight=".15"
                          android:layout_height="wrap_content"
                          android:layout_width="0dip"
                          android:textColor="#000000"
                          android:gravity="right"
                          android:layout_gravity="center_vertical" /&gt;
  
  
                       &lt;ImageView
                          android:src="@drawable/ic_up"
                          android:layout_height="15dp"
                          android:layout_width="0dip"
                          android:layout_weight=".05"
                          android:layout_gravity="center_vertical" /&gt;
                  &lt;/LinearLayout&gt;
              &lt;/TableRow&gt;
  </code></pre>
  
  <p>How can i add these programatically in Activity instead of xml Layout.as it involves layout weight and weight sum.</p>
  
  <p>sample output for reference</p>
  
  <p><img src="https://i.stack.imgur.com/yH9F1.png" alt="enter image description here"></p>