列表视图分缘 [英] Listview divider margin

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

问题描述

我想设定一个利润率为列表视图分。
分频器是虚线:

I'm trying to set a margin to a listview divider.
The divider is a dashed line:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="line" >
    <stroke
        android:dashGap="1dp"
        android:dashWidth="1.5dp"
        android:width="1dp"
        android:color="#FF404040" />

    <size android:height="3dp" />

</shape>


列表视图在这里我设置分频器


and a listview where i set the divider

<ListView
    android:id="@+id/lv_news_feed_list"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@color/white"
    android:divider="@drawable/ch_dashed_line_divider"
    />


但我希望有一个分隔的保证金左,右。 我也试着设置填充的形状,但列表视图被忽略的空白。


but I want a divider margin left and right. I also tried to set a padding to the shape, but the listview is ignoring the padding.

    <padding
        android:bottom="15dp"
        android:left="15dp"
        android:right="15dp"
        android:top="15dp" />


是否有可能来设置保证金为列表视图分 - 适配器在getView除了()


Is there any possibility to set a margin to the listview divider - except in the getView() of the Adapter?

推荐答案

插图是要走的路

<?xml version="1.0" encoding="UTF-8"?>
<inset xmlns:android="http://schemas.android.com/apk/res/android"
    android:insetLeft="15dp"
    android:insetRight="15dp" >

    <shape
        android:shape="line" >
        <stroke
            android:dashGap="1dp"
            android:dashWidth="1.5dp"
            android:width="1dp"
            android:color="#FF404040" />

            <size android:height="3dp" />

    </shape>

</inset>

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

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