First you need to make a custom adapter
for Listview
.
Then, for drawing line use :
<View
android:layout_width="fill_parent"
android:layout_height="2dp"
android:background="#c0c0c0"/>
Now since the width of line is dependent on number inside listview item, you could easily set the layout_width
of line inside getView()
method of custom adapter
.
You can set the height and width of a view in a LinearLayout
like this
View someView = (View).findViewById(someId):
LinearLayout.LayoutParams params = (LinearLayout.LayoutParams)
someView .getLayoutParams();
params.height = 130;
someView .setLayoutParams(params);