RoundImageView支持圆形、圆角、椭圆,可定制每个角的大小

screenshot.png

Gradle

dependencies {
    compile 'org.raphets:roundimageview:1.2.0'
}

Usage

Define in xml:

<org.raphets.roundimageview.RoundImageView
            android:layout_width="180dp"
            android:layout_height="180dp"
            android:src="@drawable/a"
            app:border_width="3dp"
            app:border_color="@android:color/holo_red_dark"
            app:leftBottom_corner_radius="0dp"
            app:leftTop_corner_radius="30dp"
            app:rightBottom_corner_radius="30dp"
            app:rightTop_corner_radius="0dp"
            app:type="round" />

Or in code:

        RoundImageView iv1= (RoundImageView) findViewById(R.id.iv1);

        iv1.setBorderWidth(3)
                .setBorderColor(Color.RED)
                .setType(RoundImageView.TYPE_ROUND)
                .setLeftTopCornerRadius(0)
                .setRightTopCornerRadius(10)
                .setRightBottomCornerRadius(30)
                .setLeftBottomCornerRadius(50);

        Picasso.with(this)
                .load("http://ww2.sinaimg.cn/large/610dc034jw1fa42ktmjh4j20u011hn8g.jpg")
                .into(iv1);

源码

https://github.com/RaphetS/RoundImageView

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容