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
Asked
Active
Viewed 2,727 times
3 Answers
15
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
.

Gabriele Mariotti
- 320,139
- 94
- 887
- 841
-
1any suggestion about shadow – Karim Ata Feb 28 '20 at 23:38
-
3did you find any solutiona about shadow? @KarimAta – LMaker Jun 29 '20 at 00:28
1
You can try to create a rounded bitmap with Glide or Picasso. In this case you can write transformation. See, for instance, Make ImageView with Round Corner Using picasso.
Then you can create an image with a shadow. After that overlap one image over another.

CoolMind
- 26,736
- 15
- 188
- 224
-
-
@KarimAta, Yes, I mean your own transformation with one corner (if it is possible). Or create a circle and overlay with 1/4 of the image in the top-right angle. – CoolMind Feb 11 '20 at 15:55
1
You can use something like this:
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#587E9B">
<Button
android:id="@+id/button5"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintHeight_percent="0.4"
app:layout_constraintDimensionRatio="1:1"
android:text="Button"
android:background="@drawable/my_shape"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
drawable/my_shape
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="12dp" />
<solid android:color="#CF2525" />
<corners
android:topLeftRadius="60dp"
android:bottomRightRadius="60dp"
android:bottomLeftRadius="60dp"/>
<stroke
android:width="1dp"
android:color="@android:color/black" />
</shape>
Here is how it will look:
Now all you need to do is to change the corners
inside drawable/my_shape

Tamir Abutbul
- 7,301
- 7
- 25
- 53
-
-
Maybe you can use cardView like [in this answer](https://stackoverflow.com/a/41479670) – Tamir Abutbul Feb 11 '20 at 16:27
-
Another good answer [here](https://stackoverflow.com/a/57834981/8274756) – Tamir Abutbul Feb 11 '20 at 16:34