Marek Szanyi
Marek Szanyi

Reputation: 2328

Android ListView divider strange problem

I have a ListView with a divider of 1pd thickness. But somehow every second divider in the ListView is thicker then the others ...as you can see on the picture

alt text

the code of the ListView is real simple :

 <ListView 
         android:id="@+id/directoriesListView"
         android:choiceMode="singleChoice"
         android:clickable="true"
         android:layout_weight="2.5"
         android:cacheColorHint="@null"
         android:footerDividersEnabled="false"
         android:fadingEdge="none"
         style="@style/ListView_NarrowItems"
         />

and the style :

<style
    name="ListView_NarrowItems"
    >
    <item name="android:layout_width">fill_parent</item>
    <item name="android:layout_height">fill_parent</item>
    <item name="android:textColor">#FFFFFF</item>
    <item name="android:background">#000000</item>
    <item name="android:divider">#FFFFFF</item>
    <item name="android:dividerHeight">1px</item>
</style>

any idea what is wrong ?

Upvotes: 1

Views: 974

Answers (2)

tidbeck
tidbeck

Reputation: 2418

According to this blog post it's due to your application running in compatibility mode and the solution is to put minSdk and targetSdk in your application manifest like this:

<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="8"/>

Upvotes: 1

CommonsWare
CommonsWare

Reputation: 1007554

Android is scaling your activity. Add the appropriate <supports-screens> element to your manifest, set to indicate what screen sizes you are handling, and this effect should disappear.

Upvotes: 5

Related Questions