有没有办法在 android xml 中创建自定义可绘制形状?

Is there a way to create custom drawable shapes in android xml?

下面是蓝色矩形边框的示例。我想要做的是创建我自己的形状值 <shape android:shape="rectangle" >,其中形状不是矩形,而只是一个类似于此处这张照片 https://banner2.kisspng.com/20180205/ecq/kisspng-video-camera-film-frame-video-camera-viewfinder-frame-for-digital-camera-5a7860497defb6.1781782515178384095158.jpg.

的角框

到目前为止,我尝试使用 dashWidth 和 dashGap 来尝试使其适合边角,但我遇到了问题。我在网上看过 (youtube/google),我看到了线条、椭圆形和环形的形状。没有角落,所以我想创建自己的

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >

  <item>
    <shape android:shape="rectangle" >
      <solid android:color="@android:color/transparent" />
      <stroke
          android:width="4dp"
          android:color="#263ADD"
          android:dashWidth="80dp"
          android:dashGap="80dp"/>
    </shape>
  </item>
</layer-list>

Android 现在将 SVG 导入 XML。 使用 Android Studio 将图像转换为 SVG 并简单导入。

我唯一能想到的就是使用渐变和一些属性。 示例如下:

<item>
<shape>
  <gradient
      android:startColor="Your required color"
      android:centerY="Your required position"
      android:centerX="Your required position"
      android:endColor="Your required color"
      android:angle="Your required angle"
  />
</shape>

可以看到对方的必填属性和使用行的位置。 Attributes for Gradient