开发者

Bottom border for list view in android

I'm trying to add a bottom border my listview in android The code i used is

<ListView 
  android:id="@+id/listview"
  android:layout_width="fill_parent" 
  android:layout_height="wrap_content" 
  android:layout_weight="1" 
  android:scrollbars="horizontal" 
  android:background="#ffffff"
  android:cacheColorHint="#ffffff"
  /> 

It is working when there is only lest no of items. But not working when no of items is more I mean when the items cannot display in on screen Thanks

The entire layout i used

>

 <LinearLayout
    android:orientation="horizontal"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:gravity="center"
    android:background="@drawable/navigationbar"
    >

<ImageView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="@drawable/search_icon"/>

 <LinearLayout
    android:orientation="horizontal"
    android:layout_width="5dp"
    android:layout_height="wrap_content"/>

<EditText   
    android:layout_width="220dp"
    android:layout_height="wrap_content"
    android:layout_marginTop="4dp"
    android:layout_marginBottom="2dp"
    android:singleLine="true"
    android:id="@+id/categoryListEditText"/>    

 <LinearLayout
    android:orientation="horizontal"
    android:layout_width="5dp"
    android:layout_height="wrap_content"/>

<Button
    android开发者_开发知识库:layout_width="50dp"
    android:layout_height="wrap_content"
    android:layout_marginTop="4dp"
    android:layout_marginBottom="2dp"
    android:textSize="10dp"
    android:textStyle="bold"
    android:background="@drawable/switch_list_button"
    android:id="@+id/switchListsButton"/>

</LinearLayout>
    <TextView   style="@style/firstBannerTextView"
    android:text="Type a category name to filter the List."/>



    <TextView   
    style="@style/secondBannerTextView"     
    android:id="@+id/categoryList"
    />

<ListView 
  android:id="@+id/listview"
  android:layout_width="fill_parent" 
  android:layout_height="wrap_content" 
  android:layout_weight="1" 
  android:scrollbars="horizontal" 
  android:background="#ffffff"
  android:cacheColorHint="#ffffff"
  /> 


Labeep if you check the dividers are only within the listitems it misses the bottom as well as the top. Try using the shape tag and set is as a background to your listVIew.

Or in case you need a bottom divider only?

Just have a view tag.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜