Android ShapeableImageView使用详解,告别shape、三方库,2024年Android开发者跳槽指南

07-06 1638阅读

android:layout_width=“wrap_content”

android:layout_height=“wrap_content”

android:layout_margin=“10dp”

android:padding=“2dp”

android:src=“@mipmap/ic_avatar”

app:shapeAppearance=“@style/CircleStyle”

app:strokeColor=“@color/red”

app:strokeWidth=“4dp” />

  • app:strokeColor 描边颜色

  • app:strokeWidth 描边宽度

  • 注意这里padding的数值是描边宽度的一半,后面会说

切角

Android ShapeableImageView使用详解,告别shape、三方库,2024年Android开发者跳槽指南

  • cornerFamily:cut 处理模式变为裁剪

菱形

Android ShapeableImageView使用详解,告别shape、三方库,2024年Android开发者跳槽指南

  • 同样,裁剪模式下圆角大小也可以计算

叶子

Android ShapeableImageView使用详解,告别shape、三方库,2024年Android开发者跳槽指南

  • cornerSizeTopLeft 左上圆角

  • cornerSizeBottomRight 右下圆角

  • 以此类推,左上、左下、右上、右下等

半圆

Android ShapeableImageView使用详解,告别shape、三方库,2024年Android开发者跳槽指南

六边形

Android ShapeableImageView使用详解,告别shape、三方库,2024年Android开发者跳槽指南

VPS购买请点击我

文章版权声明:除非注明,否则均为主机测评原创文章,转载或复制请以超链接形式并注明出处。

目录[+]