分的ListView不显示在Android中5 [英] ListView divider not showing in Android 5

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

问题描述

我有我所定义的自定义绘制的分频器一个简单的列表视图。我已经定义的分隔高度为1DP。 ListView控件是一个片段中。

I have a simple listview for which I have defined a custom drawable for the divider. I have defined the divider height to be 1dp. The listview is within a fragment.

<shape
    android:shape="line" >
    <stroke
        android:color="@color/custom_color" />

    <gradient android:height="1dp" />

</shape>

这对所有的Andr​​oid版本,除了L.的伟大工程

It works great for all Android versions except L.

什么我失踪?

推荐答案

您应该使用机器人:形状=矩形而不是机器人:形状=行,使其在每个Android版本的工作......(也改变笔画

You should use android:shape="rectangle" instead of android:shape="line" to make it work on every android version... (also change stroke to solid)

<shape
    android:shape="rectangle" >
    <solid android:color="@color/custom_color" />
    <gradient android:height="1dp" />
</shape>

玩得开心!

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

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