How to create a dynamic table view in android -
i used concept this: (1.) creating custom listview , code below:
custom_row_view :
<relativelayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignparentleft="true" android:layout_alignparenttop="true" > <!-- android:background="#801a1a1a" > --> <tablerow android:id="@+id/tablerow10" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_centerhorizontal="true" android:background="#000000" android:padding="1dp"> <textview android:id="@+id/textview1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:padding="2dp" android:gravity="center_horizontal" android:textsize="10dp" android:background="#ffffff" android:textappearance="@style/mytextviewtext" android:text="textview" /> <textview android:id="@+id/textview2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="2" android:padding="2dp" android:textsize="10dp" android:gravity="center_horizontal" android:background="#ffffff" android:layout_marginleft="1dp" android:textappearance="@style/mytextviewtext" android:text="textview" /> <textview android:id="@+id/textview3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:padding="2dp" android:textsize="10dp" android:gravity="center_horizontal" android:background="#ffffff" android:layout_marginleft="1dp" android:textappearance="@style/mytextviewtext" android:text="textview" /> <textview android:id="@+id/textview4" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight=".5" android:padding="2dp" android:textsize="10dp" android:gravity="center_horizontal" android:background="#ffffff" android:layout_marginleft="1dp" android:textappearance="@style/mytextviewtext" android:text="textview" /> </tablerow> </relativelayout>
i got problem when using above procedure, use weight property in row custom view, yet textview stretched according text size. problem :