如何给Android应用设置圆角图片

  介绍

本篇文章给大家分享的是有关如何给Android应用设置圆角图片,小编觉得挺实用的,因此分享给大家学习,希望大家阅读完这篇文章后可以有所收获,话不多说,跟着小编一起来看看吧。

主要原理是使用系统自带api:

公共类MainActivity延伸AppCompatActivity {
  
  私人ImageView mImgRectRound;
  私人ImageView mImgRound;
  
  @Override
  保护空白> & lt;及# 63;xml version=?.0”;编码=皍tf-8", # 63;比;
  http://schemas.android.com/apk/res/android" & lt; LinearLayout xmlns: android=?;
  xmlns:工具=癶ttp://schemas.android.com/tools"
  android: id=癅 + id/activity_main"
  android: layout_width=癿atch_parent"
  android: layout_height=癿atch_parent"
  android:取向=皏ertical"
  工具:上下文=癱om.cjl.roundedbitmap.MainActivity"比;
  
  & lt; ImageView
  android: id=癅 + id/img_rect_rounded"
  android: layout_width=?00 dp"
  android: layout_height=?00 dp"
  android: layout_marginTop=?0 dp"
  android: layout_gravity=癱enter_horizontal"/比;
  
  & lt; ImageView
  android: id=癅 + id/img_rounded"
  android: layout_marginTop=?0 dp"
  android: layout_width=?00 dp"
  android: layout_height=?00 dp"
  android: layout_gravity=癱enter_horizontal"/比;
  & lt;/LinearLayout> 

以上就是如何给Android应用设置圆角图片,小编相信有部分知识点可能是我们日常工作会见到或用到的。希望你能通过这篇文章学到更多知识。更多详情敬请关注行业资讯频道。

如何给Android应用设置圆角图片