带点/虚线分隔符的 Android gridview

标签 android android-gridview

我必须设计一个具有带虚线/点线分隔符的 gridview 的布局。任何人都可以让我知道我该怎么做吗?

这个问题可能类似于 another question asked here in stackoverflow ,但它是不同的,因为:

A] 我需要一条虚线

B] 虚线不应触及单元格的边缘,根据那个 question 给出的答案无法完成。 .

Grid layout with dotted/dashed separator

最佳答案

你可以试试下面的代码:

drawable/dotted_shape.xml:

<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="line">

    <stroke
       android:color="#C7B299"
       android:dashWidth="15px"
       android:dashGap="15px"
       android:width="2dp"/>
</shape>

这将为您提供虚线分隔符。谢谢。

关于带点/虚线分隔符的 Android gridview,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32695919/

相关文章:

android - 有没有办法使用 Scala 将两个或多个 .dex 文件合并到一个 .dex 文件中?

android - 未设置 Linkedin 登录 android SDK 访问 token

java - 蓝牙 GATT UUID

android - getFragmentById 返回 null

android - 如何在 Android 中单击的 GridView 项目上设置可绘制的背景?

Android - GridView 中 Assets 文件夹中的图像

android - 如何在 android 中制作带有图像的自定义网格?

android - 自定义 adb 提示

android - 每次我将 View 从 ListView 更改为 GridView 时如何停止加载

android - 使用 GridView 的自定义适配器