Android之字形布局

标签 android android-layout android-xml android-drawable zigzag

我需要在 Android 中创建收据布局。这个想法很简单,顶部有锯齿形的矩形布局。

enter image description here

甚至,我试过虚线但没有任何效果。

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

<stroke
   android:color="#FF00"
   android:dashWidth="5dp"
   android:dashGap="5dp" />
</shape>

最佳答案

试试这个:https://github.com/beigirad/ZigzagView

支持topbottom之字形。

<ir.beigirad.zigzagview.ZigzagView
    android:layout_width="match_parent"
    android:layout_height="240dp"
    app:zigzagBackgroundColor="#8bc34a"
    app:zigzagElevation="8dp"
    app:zigzagHeight="10dp"
    app:zigzagShadowAlpha="0.9"
    app:zigzagSides="top|bottom"
    app:zigzagPaddingContent="16dp">

    // add child view(s)

</ir.beigirad.zigzagview.ZigzagView>

ZizagView

关于Android之字形布局,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40253841/

相关文章:

java - 根据屏幕尺寸查找每厘米像素?

java - 应用程序 Intent 不起作用,应用程序崩溃

android - 无法设置所选抽屉项目的背景颜色

Android xml 布局和添加用 xml 编写的自定义 View

java - fragment 上的传感器管理器(如果可见则添加;如果不可见则删除)

android - 小米设备停止前台服务

android - Android 中画廊的最佳替代品是什么?

android studio 3.3.1 color..xml 错误 : Can't determine type for tag '<selector xmlns:android="http://schemas. android.com/apk/res/android">

android - 无法删除叠加 View

android - 具有两种纯色的矩形