Project Address: Http://my.oschina.net/u/1046838/admin/new-blog
1.
Import the Circleimageview.java into your own project.
2. Layout add:
......
xmlns:app= "Http://schemas.android.com/apk/res-auto"
......
3.
Configuration file: Res/values/attrs.xml
<?xml version= "1.0" encoding= "Utf-8"?>
<resources>
<declare-styleable name= "Circleimageview" >
<attr name= "Border_width" format= "Dimension"/>
<attr name= "Border_color" format= "Color"/>
</declare-styleable>
</resources>
4.
Use Circleimageview directly in the layout file:
<com.youthforty.yungoubi.circleimageview
Android:id= "@+id/user_head"
Android:layout_width= "Wrap_content"
android:layout_height= "Wrap_content"
Android:layout_centervertical= "true"
Android:layout_alignparentleft= "true"
Android:layout_alignparentstart= "true"
android:layout_marginleft= "8DP"
Android:layout_marginstart= "8DP"
Android:padding= "8DP"
android:src= "@drawable/user_head_default"
android:contentdescription= "@string/app_name"
App:border_width= "2DP"
app:border_color= "@color/dark"
android:onclick= "Btn_user_head"/>
Note: You cannot set scaletype when you use it.
Android Open source project, circular ImageView Circleimageview