2010-10-21 37 views
1

我想添加一个下边框我的ListView android的 我使用的代码列表视图底部边框在Android电子

<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" 
    /> 

它工作时,有无非是怕没有项目。但是,没有项目的工作不更 我的意思是,当项目不能在屏幕上显示 感谢

整个布局我用

>

<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" 
    /> 

+0

你能提供整个布局吗?您需要在整个布局的上下文中使用ListView,以确定如何将列表视图锚定到底部边界,或者至少确保底部边框不会被列表视图取代。 – 2010-10-21 07:39:51

+0

谢谢你考虑我的问题...我已经添加了我的问题的完整布局...谢谢 – 2010-10-21 09:33:26

+0

anambullan:你认为是什么“底部边界”? – CommonsWare 2010-10-21 11:40:37

回答

0

Labeep如果你检查分隔符只在列表项内,它会漏掉底部和顶部。尝试使用形状标记并将其设置为listVIew的背景。

或者如果您只需要底部分频器?

只是有一个视图标签。