Linux 拨号vps windows公众号手机端

android圆角图片怎么设置

lewis 5年前 (2020-01-25) 阅读数 15 #程序编程
文章标签 android

要设置Android圆角图片,可以通过以下步骤实现:

  1. 在drawable文件夹下新建一个xml文件,命名为round_corner.xml(可以自定义名称),并添加以下代码:
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
    <corners android:radius="10dp" />
</shape>
  1. 在ImageView的src属性中引用该xml文件,并设置需要显示的图片:
<ImageView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:src="@drawable/your_image"
    android:background="@drawable/round_corner" />
  1. 将需要显示的图片放置在drawable文件夹下,并将图片命名为your_image.png(可以自定义名称)。

  2. 最后,在ImageView的background属性中引用前面创建的round_corner.xml文件,即可实现圆角图片效果。

通过以上步骤,就可以在Android应用中实现圆角图片的效果。

版权声明

本文仅代表作者观点,不代表米安网络立场。

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

热门