android - align list items of listview in 4 columns -
i have xml haded each column want table layout , table row, cant align columns tried put android:layout_weight id doesn alin right way can me.
output example:
xxxxxx 11111 11111 11111
xml ;
<tablelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical" > <tablerow android:layout_width="match_parent" android:layout_height="wrap_content" > <tablelayout android:layout_width="wrap_content" android:layout_height="wrap_content" > <tablerow> <textview android:id="@+id/id" android:layout_width="fill_parent" android:layout_height="wrap_content" android:visibility="gone" /> <textview android:id="@+id/id_instit" android:layout_width="fill_parent" android:layout_height="wrap_content" android:visibility="gone" /> <textview android:id="@+id/descricao" android:layout_width="fill_parent" android:layout_height="wrap_content" android:paddingleft="6dip" android:paddingtop="6dip" android:textsize="17dip" android:textstyle="bold" /> </tablerow> </tablelayout> <tablelayout android:layout_width="wrap_content" android:layout_height="wrap_content" > <tablerow> <textview android:id="@+id/data" android:layout_width="fill_parent" android:layout_height="wrap_content" android:paddingleft="6dip" android:paddingtop="6dip" android:textsize="17dip" android:textstyle="bold" /> </tablerow> </tablelayout> <tablelayout android:layout_width="wrap_content" android:layout_height="wrap_content" > <tablerow> <textview android:id="@+id/data2" android:layout_width="fill_parent" android:layout_height="wrap_content" android:paddingleft="6dip" android:paddingtop="6dip" android:textsize="17dip" android:textstyle="bold" /> </tablerow> </tablelayout> <tablelayout android:layout_width="wrap_content" android:layout_height="wrap_content" > <tablerow> <textview android:id="@+id/qtd" android:layout_width="fill_parent" android:layout_height="wrap_content" android:paddingleft="6dip" android:paddingtop="6dip" android:textsize="17dip" android:textstyle="bold" /> </tablerow> </tablelayout> </tablerow> </tablelayout>
hope you...
<?xml version="1.0" encoding="utf-8"?> <tablelayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/tablelayout1" android:layout_width="match_parent" android:layout_height="match_parent" android:shrinkcolumns="*" android:stretchcolumns="*" > <tablerow android:id="@+id/tablerow1" android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center_horizontal" > <textview android:id="@+id/textview1" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_span="4" android:gravity="center" android:text="my report view" android:textsize="18dp" android:textstyle="bold" > </textview> </tablerow> <tablerow android:id="@+id/tablerow2" android:layout_width="match_parent" android:layout_height="wrap_content" > <textview android:id="@+id/textview2" android:text="" > </textview> <textview android:id="@+id/textview2" android:gravity="center" android:text="m" android:textstyle="bold" android:typeface="serif" > </textview> <textview android:id="@+id/textview3" android:gravity="center" android:text="t" android:textstyle="bold" android:typeface="serif" > </textview> <textview android:id="@+id/textview4" android:gravity="center" android:text="w" android:textstyle="bold" android:typeface="serif" > </textview> <textview android:id="@+id/textview5" android:gravity="center" android:text="t" android:textstyle="bold" android:typeface="serif" > </textview> <textview android:id="@+id/textview6" android:gravity="center" android:text="f" android:textstyle="bold" android:typeface="serif" > </textview> </tablerow> <tablerow android:id="@+id/tablerow3" android:layout_width="match_parent" android:layout_height="wrap_content" > <textview android:id="@+id/textview7" android:text="day high" android:textstyle="bold" > </textview> <textview android:id="@+id/textview8" android:gravity="center_horizontal" android:text="xxxxx" > </textview> <textview android:id="@+id/textview9" android:gravity="center_horizontal" android:text="11111" > </textview> <textview android:id="@+id/textview10" android:gravity="center_horizontal" android:text="34°c" > </textview> <textview android:id="@+id/textview11" android:gravity="center_horizontal" android:text="11111" > </textview> <textview android:id="@+id/textview12" android:gravity="center_horizontal" android:text="11111" > </textview> </tablerow> </tablelayout>
Comments
Post a Comment