you*_*_08 7 android android-layout android-xml zigzag android-drawable
我需要在 Android 中创建收据布局。这个想法很简单,一个带有锯齿形顶部的矩形布局。
甚至,我试过虚线但没有任何效果。
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="line">
<stroke
android:color="#FF00"
android:dashWidth="5dp"
android:dashGap="5dp" />
</shape>
Run Code Online (Sandbox Code Playgroud)
试试这个:https : //github.com/beigirad/ZigzagView
支持top和bottom锯齿形。
<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>
Run Code Online (Sandbox Code Playgroud)
创建小三角形并使用重复背景
重复背景.xml
<?xml version="1.0" encoding="utf-8"?>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/imagename"
android:tileMode="repeat" />
Run Code Online (Sandbox Code Playgroud)
并在任何视图中使用它
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/repeat_background" />
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5414 次 |
| 最近记录: |