分的ListView不显示 [英] ListView divider not showing
问题描述
我有BaseAdapter一个ListView。在XML中,我指定的项目除法红色与10dip高度。
I have a ListView with BaseAdapter. In XML, I specified item divider as red color with 10dip height.
<ListView android:layout_width="fill_parent"
android:layout_height="0px"
android:id="@+id/lv"
android:layout_weight="1"
android:cacheColorHint="#00000000"
android:divider="#FF0000"
android:dividerHeight="10dip"
android:fadingEdge="none">
</ListView>
但是,应用程序运行时,我没有看到项目之间的红色分隔。谁能告诉我,为什么?谢谢你。
But, when the app runs, I didn't see the red dividers between items. Can someone tell me why? Thanks.
编辑:在我的适配器code,我有以下的code:
in my adapter code, I have the following code:
@Override
public boolean areAllItemsEnabled() {
return false;
}
@Override
public boolean isEnabled(int position) {
return false;
}
因为我要控制每个项目的onclick行为。我不知道code是否高于使得分隔消失了。
because I want control the onClick behavior of each item. I don't know whether the code above makes the dividers disappear.
推荐答案
布局是好的,它应该工作。我只是测试它自己,它没有为我工作。 尝试看到你在你的列表项目布局或您的清单活动类。
The layout is good and it should work. I just tested it myself and it did work for me. Try seeing what you have in your list item layout or your list activity class.
如果不工作,我会建议建立从样品中正常的名单,并给予该列表这些属性,看看发生了什么。
If that doesn't work I would recommend creating a normal list from the samples and give the list these attributes and see what happened.
Achie。
这篇关于分的ListView不显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!