CIRCULAR IMAGE VIEW ANDROID

Florence Njeri
1 min readJun 25, 2019

--

All you need is to wrap your ImageView inside a frame layout.Then set the background to the FrameLayout as a custom drawable.

<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_gravity="center_horizontal"
android:background="@drawable/circle_background"
android:padding="20dp"
>
<!--Circular Image View-->
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_user"
/>

</FrameLayout>

The code to the custom background:

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

<stroke
android:width="1dp"
android:color="#FFFFFF"
/>
</shape>

--

--

Florence Njeri
Florence Njeri

Written by Florence Njeri

Software Engineering || Career || Life

Responses (1)