目标: 圆角正方形

1.布局
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
tools:context=".MainActivity">
<ImageView
android:id="@+id/imageVie

本文介绍了如何在Android中创建圆角正方形视图,通过关键代码展示了利用setOutlineProvider和setClipToOutline方法进行裁剪,使视图呈现圆角效果,并给出了运行结果以及裁剪前后的图片对比。
最低0.47元/天 解锁文章
3684

被折叠的 条评论
为什么被折叠?



