安卓imageView倒角边框

本文详细介绍如何使用Raphets的RoundImageView库在Android应用中创建具有特定边框宽度、颜色及圆角设置的圆形图片视图。通过XML布局文件或代码方式调用,展示如何加载远程图片并应用到自定义的RoundImageView中。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

效果图

 

第一步:在你的依赖包中添加

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

第二步:直接调用

<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" />

或者代码实现

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);
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值