2012-03-31 78 views

回答

3

你可以在你的列表適配器類此XML文件像

ItemsAdapter ItemsAdapter = new ItemsAdapter(EnterpriseFertilisersScreen.this, 
       R.layout.list, Constant.FERTILIZERMANAGERARRAY); 

R.layout。「下面的xml文件」和用戶進一步白色。


<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_margin="2dp" 

    android:background="@color/list_bg" > 

    <TextView 
     android:id="@+id/post" 
     android:layout_width="wrap_content" 
     android:layout_height="50dp" 
     android:layout_marginLeft="7dp" 
     android:layout_toRightOf="@+id/bite_image" 
     android:gravity="center_vertical" 
     android:textColor="@android:color/white" 
     android:textSize="20sp" /> 

</RelativeLayout> 

如果您有其他問題,請隨時..

2

您可以創建適用於列表的適配器,它將分隔符作爲元素(通過getView)。 這是非標準Android的做法

+0

感謝每一個答覆,我再次得到了我的解決方案的感謝 – Aamirkhan 2012-04-02 05:10:34

1

,你可以把它添加到getview Methoid如下:

public View getView(int position, View convertView, ViewGroup parent) {  
    if(items.get(position).get("name").startsWith("-")){  
     View divider = mInflater.inflate(R.layout."yourlayout",null); 
     return divider;   } 

還必須添加開頭的項目名稱「 - 」要添加一個分頻器。

希望這是很有幫助的

相關問題