Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ListView divider not showing [duplicate]

Tags:

android

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.

Edit: in my adapter code, I have the following code:

@Override
public boolean areAllItemsEnabled() {
    return false;
}

@Override
public boolean isEnabled(int position) {
    return false;
}

because I want control the onClick behavior of each item. I don't know whether the code above makes the dividers disappear.

like image 990
Kai Avatar asked Apr 07 '11 21:04

Kai


1 Answers

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.

like image 53
achie Avatar answered Nov 16 '22 23:11

achie