如何使用三个角和阴影制作图像视图

Kar*_*Ata 5 xml android imageview material-components-android

图片

如何制作只有三个角的图像,我尝试使用框架布局插入图像视图,并使其成为原始图像的资源,添加另一个具有 3 个角的边框 src 的图像视图,但它不起作用

Gab*_*tti 11

通过Material Components 库,您可以使用MaterialShapeDrawable.

只需使用类似的东西:

  <com.google.android.material.imageview.ShapeableImageView
      app:shapeAppearanceOverlay="@style/onlyonecorner"
      app:srcCompat="@drawable/xxx"
      ../>
Run Code Online (Sandbox Code Playgroud)

和:

  <style name="onlyonecorner">
    <item name="cornerFamily">rounded</item>
    <item name="cornerSize">50%</item>
    <item name="cornerSizeTopRight">0dp</item>
  </style>
Run Code Online (Sandbox Code Playgroud)

在此处输入图片说明

ShapeableImageView需要最少的版本1.2.0-alpha03

  • 你找到关于阴影的解决方案了吗?@卡里姆塔 (3认同)