2014-05-15 13 views
1

我在此處使用自定義列表視圖,並已禁用列表視圖的分隔線。Java Android - 已禁用分隔線,但仍顯示爲

我也嘗試了正常的listview(不是自定義的),但它仍然沒有奏效。除了從xml中修改它之外,還有什麼辦法嗎?

這裏是爲ListView XML代碼

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:showDividers="none" 
tools:context=".MainActivity" > 

<ListView 
    android:id="@+id/lvListItem" 
    android:layout_width="0dp" 
    android:layout_height="wrap_content" 
    android:layout_weight="1" 
    android:divider="@null" 
    android:dividerHeight="0px" > 
</ListView> 

有人能幫助我擺脫分頻器的? :) 謝謝!

+0

有一點建議:在listView中設置layout_weight會對性能產生重大影響。嘗試擺脫它或切換到RelativeLayout – Spotlight

+0

好的,我會牢記這一點。謝謝! :) – user3640187

回答

1

設置dividerHeight爲零,並分頻器爲null像這樣的XML:

android:dividerHeight="0dp" 
android:divider="@null" 

通知,0dp0px。 希望它可以工作

+0

已經嘗試過,但仍然..哈哈我很好奇這件事。 – user3640187

+0

您應該將您的android:layout_width =「0dp」更改爲wrap_contant或match_parent。或刪除所有內容並從頭開始重新開始 –