• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

how to control the length of devider in ListView?

fan8715

Lurker
Mar 6, 2011
6
0
dos anyone know how to control the length of the devider in the listView ,..everytime i create a listview the devider allway "fill_parent",is there any method to set the length?,

because in my progect ,i create a linearlayout,,and set the orientation="horizontal" ,but i want the left side show the lsitView ,and the right to show other things ..and i set the itemview in the listview "wrap_content",the same to the listView itself..but the devider is also "fill_parent"..

if anyone know how to set the length of the devider...please tell me,,i need you help....
 
hah ,i fond a way to do it ... just set a <ScrollView> to content a listView ..just like the ApiDemo ....

<LinearLayout
android:eek:rientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<ScrollView
android:layout_width="200dip"
android:layout_height="120dip"
android:background="@android:drawable/edit_text">
<ListView
android:id="@id/android:list"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20px"
android:drawSelectorOnTop="false"/>
</ScrollView>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10px"
android:gravity="center_horizontal"
android:textSize="13pt"
android:textStyle="bold"
android:text="Lyric"/>
</LinearLayout>
 
Upvote 0
so ..you can set a LinearLayout to instead of the ScrollView....

<LinearLayout
android:eek:rientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<LinearLayout
android:eek:rientation="vertical"
android:layout_width="200dip"
android:layout_height="120dip">
<ListView
android:id="@id/android:list"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20px"
android:drawSelectorOnTop="false"/>
</LinearLayout>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10px"
android:gravity="center_horizontal"
android:textSize="13pt"
android:textStyle="bold"
android:text="Lyric"/>
</LinearLayout>


can anyone have better idears..?
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones