-2

I'm working on a recyclerView and there is a problem for me to make it's view: in the view I have an imageView but right-top corner and left-bottom corner have cuts. How can I do this?

enter image description here

Community
  • 1
  • 1
Ehsan
  • 2,676
  • 6
  • 29
  • 56
  • 1
    you need to some research then after you may post your question -check it -https://stackoverflow.com/questions/31024059/cutting-the-corners-off-a-layout – Adil Jun 13 '18 at 12:03
  • I saw this link before. But when I set this shape to my main layout and then load my image into imageView, the image will fill all the main layout – Ehsan Jun 16 '18 at 12:03
  • Which image please post in your question – Adil Jun 17 '18 at 17:07

2 Answers2

0

You can use the ShapeableImageView provided by the Material Components Library:

<com.google.android.material.imageview.ShapeableImageView
    app:srcCompat="@drawable/mont"
    app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.App.Cut"
    ../>

With:

<style name="ShapeAppearanceOverlay.App.Cut" parent="">
    <item name="cornerFamily">cut</item>
    <item name="cornerSizeTopRight">32dp</item>
    <item name="cornerSizeBottomLeft">32dp</item>
</style>

enter image description here

Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841
-1

Ask your designer to provide this image and add it as a src for your imageview.