【问题标题】:ListView Border ColorListView 边框颜色
【发布时间】:2013-03-27 16:39:58
【问题描述】:

是否可以在 ListView 周围创建一个1px 宽度的彩色边框?

我尝试了以下编码:

<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <gradient android:startColor="#BFFFFFFF" android:endColor="#BFFFFFFF" />
    <corners android:bottomRightRadius="10dp" android:radius="10dp"
        android:bottomLeftRadius="10dp" android:topLeftRadius="10dp"
        android:topRightRadius="10dp" />
</shape>

那么...有谁知道我如何制作边界线并设置它的颜色?

PS:我确实在其他帖子中搜索过这个问题,但没有成功,这就是我创建这个的原因。

谢谢!

【问题讨论】:

    标签: android listview border border-layout


    【解决方案1】:

    是的,这是可能的。只需添加&lt;stroke&gt;标签,如下所示

    <shape xmlns:android="http://schemas.android.com/apk/res/android"
        android:shape="rectangle">
        <gradient android:startColor="#BFFFFFFF" android:endColor="#BFFFFFFF" />
        <stroke
            android:width="1dp"
            android:color="#d8d8d8" />
        <corners android:bottomRightRadius="10dp" android:radius="10dp"
            android:bottomLeftRadius="10dp" android:topLeftRadius="10dp"
            android:topRightRadius="10dp" />
    </shape>
    

    请使用 1dp 而不是 1px,您可以根据需要替换任何边框颜色。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2010-12-24
      • 1970-01-01
      • 2011-07-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-07-16
      相关资源
      最近更新 更多