Android dashed divider in ListView

青春壹個敷衍的年華 提交于 2019-12-06 11:29:07

Its documented here: https://code.google.com/p/android/issues/detail?id=29944

You have 2 options:

  • turn off hardware acceleration: android:hardwareAccelerated="false"
  • or: listView.setLayerType(View.LAYER_TYPE_SOFTWARE, null) or xml android:layerType="software"

It gave me too a headache!

Did you name the drawable realy list_divider.html? Rename it to list_divider.xml. I'm surprised that it works in the UI editor.

A second thing which might have an impact: for the sizing of the divider use dp instead of px as units. In Listview and in divider xml. You never know how much 10 pixel are.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!