简体   繁体   中英

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

替代文字

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 ?

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.

根据博客文章,这是由于您的应用程序以兼容模式运行,而解决方案是将minSdk和targetSdk放入您的应用程序清单中,如下所示:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM