嗨,我正在制作一个Android应用程序,我必须制作产品的部分,我正在尝试使类似更快的应用程序所以这里的问题我知道我可以使用gridview制作产品部分,但我不知道如何在产品之间添加虚线边框或使网格尺寸更小,以便我想知道是否有更好的方法来实现这一点。 欢迎任何建议。 我在SO上看到了这个问题的产品 show products list in android with multicolumn custom layout 但我正在尝试的是为没有空间和虚线边框的产品制作小网格,所以如果有人有建议请告诉我
答案 0 :(得分:0)
对于虚线边框,您可以在drawable中创建新的XML文件并输入以下代码:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<stroke android:color="@color/black"
android:width="2dp"
android:dashGap="5dp"
android:dashWidth="2dp"/>
</shape>
然后在您的单项父布局集中:
android:background="@drawable/name_of_your_dotted_borders_xml"