I have implemented a layout statically in Android layouts folder xml file which is as follows
<TableRow
android:layout_height="wrap_content"
android:layout_width="match_parent"
>
<LinearLayout
android:weightSum="1.0"
android:layout_weight=".75"
android:layout_height="match_parent"
android:layout_width="0dip"
android:background="#ffef1128"
>
<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"
/>
</LinearLayout>
<LinearLayout
android:layout_weight=".25"
android:layout_height="match_parent"
android:layout_width="0dip"
>
<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" />
<ImageView
android:src="@drawable/ic_up"
android:layout_height="15dp"
android:layout_width="0dip"
android:layout_weight=".05"
android:layout_gravity="center_vertical" />
</LinearLayout>
</TableRow>
How can i add these programatically in Activity instead of xml Layout.as it involves layout weight and weight sum.
sample output for reference
you can get instance from all widget and set Layout programmatically like this