I am working with a custom listview which has 6 fields so i used horizontal scroll view with weight in each fields for required spacing among fields.Here is the code for Activity `
<HorizontalScrollView
android:id="@+id/horizontalScrollView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="30dp"
android:background="#898ea0"
android:orientation="horizontal"
android:weightSum="11" >
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_weight="2"
android:text="Name" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_weight="2"
android:text="Site Name" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_weight="1.5"
android:text="Plot No" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_weight="2.3"
android:text="Booking Id" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_weight="1.6"
android:text="Booking Date" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_weight="1.6"
android:layout_marginRight="8dp"
android:text="Cancel Date" />
</LinearLayout>
<ListView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/cancel_booking_listView"
android:background="#163330">
</ListView>
</LinearLayout>
</HorizontalScrollView>
`
And in the listview row item i am using all fields with same weight then also unable to get an equal spacing among the fields. Here is my custom rowlist code `
<LinearLayout
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="#eee"
android:orientation="horizontal"
android:weightSum="11" >
<TextView
android:id="@+id/cb_custmrnameTv"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_weight="2"
android:text="Name" />
<TextView
android:id="@+id/cb_siteNameTv"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_weight="2"
android:text="Site Name" />
<TextView
android:id="@+id/cb_plotNoTv"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_weight="1.5"
android:text="Plot No" />
<TextView
android:id="@+id/cb_bookingIdTv"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_weight="2.3"
android:text="Booking Id" />
<TextView
android:id="@+id/cb_bookingDateTv"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_weight="1.6"
android:text="Booking Date" />
<TextView
android:id="@+id/cb_cancelDateTv"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_weight="1.6"
android:layout_marginRight="5dp"
android:text="Cancel Date" />
</LinearLayout>
</HorizontalScrollView>
`
For better understanding here is screen shot of the view which i am getting.you can see here every rows have their own spacing.
I need to implement equal spacing among all fields. Any Idea to resolve it ??