我知道现在回答这个问题为时已晚,但仍然在这里发布我的答案,以便其他人可以参考:
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="100dp"
android:width="100dp"
android:viewportHeight="100"
android:viewportWidth="100">
<path
android:name="dark_triangle"
android:fillColor="#FFFFFF"
android:pathData="M 100,0 L 0,100 100,100 z" />
<path
android:name="light_triangle"
android:fillColor="#d0021b"
android:pathData="M 0,0 L 100,0 0,100 z" />
</vector>
Run Code Online (Sandbox Code Playgroud)
@Pauli。您可以使用图像来轻松练习,并且可以尝试这种方式。使用这个逻辑
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:drawable="@color/Your_color">
</item>
<item>
<rotate
android:fromDegrees="50"
android:pivotX="10%"
android:pivotY="85%"
>
<shape
android:shape="rectangle">
<solid android:color="#000000" />
</shape>
</rotate>
</item>
Run Code Online (Sandbox Code Playgroud)
如此礼貌