I'm trying to create a circular image with an orange border.
Here is my xml
<LinearLayout
android:id="@+id/circle_photo"
android:background="@drawable/circle_image_container"
android:layout_width="100dp"
android:layout_height="100dp"
app:layout_constraintVertical_chainStyle="packed"
app:layout_constraintVertical_bias="0.45"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toTopOf="@+id/edit_profile">
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/person1"
android:scaleType="centerCrop"/>
</LinearLayout>
circle_image_container.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
<solid android:color="@android:color/transparent"/>
<corners android:radius="50dp"/>
<stroke android:width="2dp" android:color="@color/colorPrimaryDark" />
</shape>
</item>
</selector>
However my image just shows in its normal rectangular state over the top of the LinearLayout
- it's not nested in a circular container. I've added android:scaleType="centerCrop"
to the image so it should be cropping.
Any idea?