CircleImageView

github地址https://github.com/hdodenhof/CircleImageView

1.将CircleImageView.java拷贝进工程目录

CircleImageView_第1张图片

 2.添加arrts.xml内容

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <declare-styleable name="CircleImageView">
        <attr name="civ_border_width" format="dimension" />
        <attr name="civ_border_color" format="color" />
        <attr name="civ_border_overlay" format="boolean" />
        <attr name="civ_fill_color" format="color" />
    </declare-styleable>
</resources>

3.在layout中添加CircleImageView组件

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:orientation="vertical"
    android:background="@color/colorzhuti"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <com.example.administrator.slidingmenu.CircleImageView
        android:id="@+id/civ_tx"
        android:layout_marginTop="50dp"
        android:layout_width="100dp"
        android:layout_gravity="center"
        android:src="@drawable/tx"
        android:layout_height="100dp" />
</LinearLayout>

4.正确显示

CircleImageView_第2张图片

你可能感兴趣的:(android,circleImageView)