/* Моя кошка замечательно разбирается в программировании. Стоит мне объяснить проблему ей - и все становится ясно. */
John Robbins, Debugging Applications, Microsoft Press, 2000
Компонент на основе ImageView, который сделан в виде круга.
Гитхаб - hdodenhof/CircleImageView
Подключаем в Gradle.
dependencies {
compile 'de.hdodenhof:circleimageview:1.1.0'
}
Задаём в разметке и указываем нужную картинку.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context=".MainActivity">
<TextView
android:text="@string/hello_world"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/textView" />
<de.hdodenhof.circleimageview.CircleImageView
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/profile_image"
android:layout_width="96dp"
android:layout_height="96dp"
android:src="@drawable/moneycat"
app:border_width="2dp"
app:border_color="#FF000000"
android:layout_below="@+id/textView"
android:layout_centerHorizontal="true"
android:layout_marginTop="84dp" />
</RelativeLayout>
Не сказал бы, что круг идеальный. Но для небольших изображений подойдёт.