欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Android 自定义圆形头像

程序员文章站 2024-02-02 12:42:22
...

CircleImageView

简介:A circular ImageView simply used as normal ImageView.

A circular ImageView simply used as normal ImageView.

Android 自定义圆形头像

it's easy to use just like ImageView,and you never need to do this:

  • create a new bitmap.
  • fixed scale type.(CENTER_CROP)

you can simply use the library like Picasso or Glide with this view.

Gradle

dependencies {
    ...
    compile 'com.vivifarm.view:circleimageview:1.2.0'
}

Usage

<com.zuowei.circleimageview.CircleImageView
  android:src="@mipmap/lufei"
  android:scaleType="centerCrop"
  style="@style/circle_style" />

<com.zuowei.circleimageview.CircleImageView
  android:src="@mipmap/lufei"
  android:scaleType="centerInside"
  style="@style/circle_style" />

<com.zuowei.circleimageview.CircleImageView
  android:src="@mipmap/lufei"
  android:scaleType="fitXY"
  style="@style/circle_style" />

<com.zuowei.circleimageview.CircleImageView
  android:src="@mipmap/lufei"
  android:scaleType="fitCenter"
  style="@style/circle_style" />

<com.zuowei.circleimageview.CircleImageView
  android:src="@mipmap/lufei"
  android:scaleType="matrix"
  style="@style/circle_style" />
相关标签: as 圆形头像