Android实现圆角图片的简单实例

  

<强> Android实现圆角图片的简单实例

  

实现效果图:
  

  

 Android实现圆角图片的简单实例

  

本来想在网上找个圆角的例子看一看,不尽人意啊,基本都是官方的演示的那张原理图,稍后会贴出。于是自己自定义了个观点,实现图片的圆角以及圆形效果。效果图:
  

  

Android圆角图片的实现形式,包括用第三方,也有系统的。比如makeramen: roundedimageview,系统的cardview,滑翔.fresco。

        编译“com.android.support: appcompat-v7:24.0.0”   编译“com.makeramen: roundedimageview: 2.2.1”   编译“com.android.support: cardview-v7:24.0.0”   编译的com.github.bumptech.glide:滑翔:3.7.0   编译“com.facebook.fresco:壁画:0.12.0”   之前            & lt; android.support.v7.widget.CardView   xmlns: android=" http://schemas.android.com/apk/res/android "   xmlns:应用=" http://schemas.android.com/apk/res-auto "   android: id=癅 + id/id_cardview”   android: layout_width=" match_parent "   android: layout_height=" wrap_content "   android: layout_gravity=" center_horizontal "   应用:cardBackgroundColor=" @color/bg_light_gray”   应用:cardCornerRadius=" 3 dp”   应用:cardUseCompatPadding=" false "   应用:cardPreventCornerOverlap=" true "      比;   & lt; ImageView   android: id=癅 + id/iv_subject”   android:重力="中心"   android: scaleType=" centerCrop "   android: layout_width=" match_parent "   android: layout_height=" 200 dp/比;      & lt; TextView   android: paddingLeft=" 5 dp "   android: paddingBottom=" 5 dp "   android:背景=" @drawable/bg_biaoti”   android: id=癅 + id/tv_subject”   android:重力=" center_vertical "   android:文本=" "   android: ellipsize="结束"   android:单行模式=" true "   android: textSize=" 13 sp”   android:输入textColor=" @color/白”   android: layout_gravity="底"   android: layout_width=" match_parent "   android: layout_height=" wrap_content "/比;      & lt;/android.support.v7.widget.CardView>      之前            iv_round=(RoundedImageView) findViewById (R.id.iv_round);   Glide.with(这).load (url) .into (iv_round);   之前            iv_cardview=(ImageView) findViewById (R.id.iv_cardview);   Glide.with(这).load (url) .into (iv_cardview);   之前            iv_fresco=(SimpleDraweeView) findViewById (R.id.iv_fresco);   Glide.with(这).load (url) .into (iv_round);   Glide.with(这).load (url) .into (iv_cardview);   Uri Uri=Uri.parse (url);   iv_fresco.setImageURI (uri);   之前            包roundimageview.forezp.com.roundimageview;      进口android.content.Context;   进口android.content.res.Resources;   进口android.graphics.Bitmap;   进口android.graphics.BitmapShader;   进口android.graphics.Canvas;   进口android.graphics.Paint;   进口android.graphics.RectF;      进口com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;   进口com.bumptech.glide.load.resource.bitmap.BitmapTransformation;/* *   *由管理员>   Glide.with(这).load (url)。变换(新GlideRoundTransform (6) .into (iv_glide);      

感谢阅读,希望能帮助到大家,谢谢大家对本站的支持。
  

Android实现圆角图片的简单实例