xml - Android: CustomListAdapter columns not aligning properly -
i have page displays list of items. each row in list has 3 columns , reason, items int list not aligning properly. below code:
custom adapter:
<textview android:id="@+id/tvcategoryname" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="name" android:layout_weight="0.90" android:textalignment="textstart"/> <textview android:id="@+id/tvweight" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="weight" android:layout_weight="0.05" android:textalignment="center"/> <textview android:id="@+id/tvaverage" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="average" android:layout_weight="0.05" android:textalignment="center"/> </linearlayout>
below screenshot of how gets displayed:
i want categories
, weight
, , average
3 columns displayed in nice table format centered
text-alignment.
updated: set layout_width="0dp"
yours textviews. otherwise layout_weight not work properly. vertical oriented parent layout set layout_height="0"
and maybe android:layout_weight="0.05"
little, try use bigger value, 0.2 tvweight , tvaverage , 0.6 tvcategoryname.
Comments
Post a Comment