且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何制作具有三个角和阴影的图像视图

更新时间:2023-01-05 14:59:36

使用

ShapeableImageView 要求的最低版本为 1.2.0-alpha03 .

How to make an image with only three corners like this I tried using frame layout the insert image view and make it's resource with original image the add another image view with src of border that has 3 corner bu it doesn't work

With the Material Components library you can use the MaterialShapeDrawable.

Just use something like:

  <com.google.android.material.imageview.ShapeableImageView
      app:shapeAppearanceOverlay="@style/onlyonecorner"
      app:srcCompat="@drawable/xxx"
      ../>

with:

  <style name="onlyonecorner">
    <item name="cornerFamily">rounded</item>
    <item name="cornerSize">50%</item>
    <item name="cornerSizeTopRight">0dp</item>
  </style>

The ShapeableImageView requires a minimum of version 1.2.0-alpha03.