有没有办法在 android studio 中制作带有对角线的可绘制视图或自定义视图?
Is there a way to make a drawable or a custom view with a diagonal line in android studio?
好吧,我想做一个像这样的可绘制对象或自定义视图。有谁知道是否有办法做到这一点?我找不到。忽略“12:00”,我只想用这条对角线做背景
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<corners android:radius="6dp" />
<solid android:color="#f5f5f5" />
</shape>
</item>
<item>
<rotate
android:fromDegrees="25"
android:pivotX="50%"
android:pivotY="50%"
android:toDegrees="25">
<shape android:shape="line">
<stroke
android:width="1dp"
android:color="#e0e0e0" />
</shape>
</rotate>
</item>
</layer-list>
好吧,我想做一个像这样的可绘制对象或自定义视图。有谁知道是否有办法做到这一点?我找不到。忽略“12:00”,我只想用这条对角线做背景
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<corners android:radius="6dp" />
<solid android:color="#f5f5f5" />
</shape>
</item>
<item>
<rotate
android:fromDegrees="25"
android:pivotX="50%"
android:pivotY="50%"
android:toDegrees="25">
<shape android:shape="line">
<stroke
android:width="1dp"
android:color="#e0e0e0" />
</shape>
</rotate>
</item>
</layer-list>