Android的ListView的分频器 [英] Android ListView Divider

查看:118
本文介绍了Android的ListView的分频器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个code:

<ListView
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:id="@+id/cashItemsList"
     android:cacheColorHint="#00000000"
     android:divider="@drawable/list_divider"></ListView>

在这里@可绘制/ list_divide是:

where @drawable/list_divide is:

<shape
 xmlns:android="http://schemas.android.com/apk/res/android"
 android:shape="line">
 <stroke
   android:width="1dp"
   android:color="#8F8F8F"
   android:dashWidth="1dp"
   android:dashGap="1dp" />
</shape>

但我没有看到任何分隔。

but I don't see any divider.

帮助?

推荐答案

伙计们,这里就是为什么你应该使用1DP或1dip的1px的,而不是:如果您指定1DP或1dip,Android将扩展下来。在一个120DPI的设备,即成为像0.75px翻译,这轮0在某些设备上,可以转换为2-3像素,它通常看起来丑陋或草率

Folks, here's why you should use 1px instead of 1dp or 1dip: if you specify 1dp or 1dip, Android will scale that down. On a 120dpi device, that becomes something like 0.75px translated, which rounds to 0. On some devices, that translates to 2-3 pixels, and it usually looks ugly or sloppy

有关分频器,1px的是正确的高度,如果你想有一个1像素的分频器,并且是例外的一切都应该是探底的规则之一。这将是在所有屏幕上1个像素。此外,1像素平常看起来对华电国际及以上屏幕更好

For dividers, 1px is the correct height if you want a 1 pixel divider and is one of the exceptions for the "everything should be dip" rule. It'll be 1 pixel on all screens. Plus, 1px usually looks better on hdpi and above screens

这不是2012了。编辑:您可能必须切换到DP / DIP开始在一定的屏幕像素密度

"It's not 2012 anymore" edit: you may have to switch over to dp/dip starting at a certain screen density

这篇关于Android的ListView的分频器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆