0

I have a very basic layout as follows. I'm just using a red background in the ImageView just to depict the situation.

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/custom_bg_grey_stroke_radius"
android:orientation="vertical" >

<ImageView
    android:id="@+id/IV"
    android:layout_width="50dp"
    android:layout_height="50dp"
    android:layout_alignParentLeft="true"
    android:background="#ff0000" />

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Text"
    android:layout_toRightOf="@+id/IV" />

</RelativeLayout>

This is the custom background I'm using:

custom_bg_grey_stroke_radius.xml

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

<!-- background color of the entire rectangle -->
<solid android:color="#FFFFFF" />

 <!-- color of borders -->
<stroke
    android:width="1dp"
    android:color="#c1c1c1" />

   <corners
    android:bottomLeftRadius="4dp"
    android:bottomRightRadius="4dp"
    android:topLeftRadius="4dp"
    android:topRightRadius="4dp" />

</shape>

I found various links which make the images circular but from all the 4 corners. This link tells how to make image circular from top or bottom. Android round a Layouts background image, only top or bottom corners

Can someone please figure out how to make Image circular from the left. It would be good if I could specify the exact radius. I want it just barely circular around 5dp.

And, I apologize for the repetitiveness, but I'm just not able to work this out.

Pranav Mahajan
  • 2,048
  • 2
  • 23
  • 36

0 Answers0