• 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
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:orientation="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>
 
so ..you can set a LinearLayout to instead of the ScrollView....

<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<LinearLayout
android:orientation="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..?
 
Back
Top Bottom