Dynamically Add a XML Layout to a TableRow Android



I want to add an xml element dynamically to the left of a TableRow.


Here is my xml.



<LinearLayout xmlns:android="http://ift.tt/nIICcg"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical" >

<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="match_parent" >

<View
android:layout_width="2dp"
android:layout_height="match_parent"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:background="@android:color/black" />

<View
android:id="@+id/view1"
android:layout_width="7dp"
android:layout_height="7dp"
android:layout_centerVertical="true"
android:layout_marginLeft="7dp"
android:background="@drawable/dot" />
</RelativeLayout>

<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:padding="20dp"
android:textAppearance="?android:attr/textAppearanceMedium" />


It looks like this: enter image description here


I want to obtain a timeline look. All of my elements are dynamically added table rows. And I need to add this xml view to the left of my table row. How can I do this?


No comments:

Post a Comment