Android 将图片快速转换成圆角的方法

使用开源项目  RoundedImageView

github上面的开源项目 官方地址为:   https://github.com/vinc3m1/RoundedImageView

效果如下:

   

下面快速的集成进来

步骤分为3个

1: 去github上下载 工程

https://github.com/vinc3m1/RoundedImageView

2: 导入工程

3  在布局中使用它

[java] view plain copy print ?
  1. <com.makeramen.rounded.RoundedImageView
  2. android:id=”@+id/imageView1”
  3. android:layout_width=”wrap_content”
  4. android:layout_height=”wrap_content”
  5. android:layout_alignParentTop=”true”
  6. android:layout_alignParentBottom=”true”
  7. android:layout_alignParentRight=”true”
  8. android:layout_alignParentLeft=”true”
  9. android:padding=”10dip”
  10. android:src=”@drawable/photo1”
  11. android:scaleType=”center”
  12. makeramen:corner_radius=”30dip”
  13. makeramen:border_width=”2dip”
  14. makeramen:border_color=”#333333” />

    <com.makeramen.rounded.RoundedImageViewandroid:id="@+id/imageView1"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_alignParentTop="true"android:layout_alignParentBottom="true"android:layout_alignParentRight="true"android:layout_alignParentLeft="true"android:padding="10dip"android:src="@drawable/photo1"android:scaleType="center"makeramen:corner_radius="30dip"makeramen:border_width="2dip"makeramen:border_color="#333333" />

属性的意义:

makeramen:border_width=”2dip”   表示图片的边框宽度为2个dp

makeramen:  corner_radius表示为  图片转圆角的弧度

修改    makeramen:corner_radius=”100dip”

当  corner_radius 设置为100dp 的时候   会呈现为圆形 .

(    注:  com.makeramen.rounded.RoundedImageView  控件的宽和高需要相等   )

修改了example中的    rounded_item.xml

[html] view plain copy print ?
  1. <?xml version=“1.0” encoding=“utf-8”?>
  2. <!–
  3. Copyright (C) 2013 Make Ramen, LLC
  4. –>
  5. <RelativeLayout
  6. xmlns:android=“http://schemas.android.com/apk/res/android”
  7. xmlns:makeramen=“http://schemas.android.com/apk/res/com.makeramen.rounded.example”
  8. android:layout_width=“match_parent”
  9. android:layout_height=“200dip”>
  10. <com.makeramen.rounded.RoundedImageView
  11. android:id=“@+id/imageView1”
  12. android:layout_width=“200dp”
  13. android:layout_height=“200dp”
  14. android:padding=“10dip”
  15. android:src=“@drawable/photo1”
  16. android:scaleType=“center”
  17. makeramen:corner_radius=“100dp”
  18. makeramen:border_width=“2dip”
  19. makeramen:border_color=“#333333” />
  20. <TextView
  21. android:id=“@+id/textView3”
  22. android:layout_width=“wrap_content”
  23. android:layout_height=“wrap_content”
  24. android:layout_marginBottom=“36dp”
  25. android:layout_marginLeft=“36dp”
  26. android:layout_alignBottom=“@+id/imageView1”
  27. android:layout_alignLeft=“@+id/imageView1”
  28. android:background=“#7f000000”
  29. android:paddingLeft=“8dp”
  30. android:paddingRight=“8dp”
  31. android:textAppearance=“?android:attr/textAppearanceSmallInverse” />
  32. <TextView
  33. android:id=“@+id/textView2”
  34. android:layout_width=“wrap_content”
  35. android:layout_height=“wrap_content”
  36. android:layout_above=“@+id/textView3”
  37. android:layout_alignLeft=“@+id/textView3”
  38. android:layout_marginBottom=“4dp”
  39. android:background=“#7f000000”
  40. android:paddingLeft=“8dp”
  41. android:paddingRight=“8dp”
  42. android:textAppearance=“?android:attr/textAppearanceMediumInverse” />
  43. <TextView
  44. android:id=“@+id/textView1”
  45. android:layout_width=“wrap_content”
  46. android:layout_height=“wrap_content”
  47. android:layout_above=“@+id/textView2”
  48. android:layout_alignLeft=“@+id/textView2”
  49. android:layout_marginBottom=“4dp”
  50. android:background=“#7f000000”
  51. android:paddingLeft=“8dp”
  52. android:paddingRight=“8dp”
  53. android:textAppearance=“?android:attr/textAppearanceLargeInverse” />
  54. </RelativeLayout>

<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2013 Make Ramen, LLC
-->
<RelativeLayoutxmlns:android="http://schemas.android.com/apk/res/android"xmlns:makeramen="http://schemas.android.com/apk/res/com.makeramen.rounded.example"android:layout_width="match_parent"android:layout_height="200dip"><com.makeramen.rounded.RoundedImageViewandroid:id="@+id/imageView1"android:layout_width="200dp"android:layout_height="200dp"android:padding="10dip"android:src="@drawable/photo1"android:scaleType="center"makeramen:corner_radius="100dp"makeramen:border_width="2dip"makeramen:border_color="#333333" /><TextViewandroid:id="@+id/textView3"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_marginBottom="36dp"android:layout_marginLeft="36dp"android:layout_alignBottom="@+id/imageView1"android:layout_alignLeft="@+id/imageView1"android:background="#7f000000"android:paddingLeft="8dp"android:paddingRight="8dp"android:textAppearance="?android:attr/textAppearanceSmallInverse" /><TextViewandroid:id="@+id/textView2"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_above="@+id/textView3"android:layout_alignLeft="@+id/textView3"android:layout_marginBottom="4dp"android:background="#7f000000"android:paddingLeft="8dp"android:paddingRight="8dp"android:textAppearance="?android:attr/textAppearanceMediumInverse" /><TextViewandroid:id="@+id/textView1"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_above="@+id/textView2"android:layout_alignLeft="@+id/textView2"android:layout_marginBottom="4dp"android:background="#7f000000"android:paddingLeft="8dp"android:paddingRight="8dp"android:textAppearance="?android:attr/textAppearanceLargeInverse" /></RelativeLayout>

如下图:

用代码创建 :

[java] view plain copy print ?
  1. RoundedImageView iv = new RoundedImageView(context);
  2. iv.setScaleType(ScaleType.CENTER_CROP);
  3. iv.setCornerRadius(10);
  4. iv.setBorderWidth(2);
  5. iv.setBorderColor(Color.DKGRAY);
  6. iv.setRoundedBackground(true);
  7. iv.setImageDrawable(drawable);
  8. iv.setBackground(backgroundDrawable);
  9. iv.setOval(true);

RoundedImageView iv = new RoundedImageView(context);
iv.setScaleType(ScaleType.CENTER_CROP);
iv.setCornerRadius(10);
iv.setBorderWidth(2);
iv.setBorderColor(Color.DKGRAY);
iv.setRoundedBackground(true);
iv.setImageDrawable(drawable);
iv.setBackground(backgroundDrawable);
iv.setOval(true);

贴上部分源码:

[java] view plain copy print ?
  1. package com.makeramen;
  2. import android.content.Context;
  3. import android.content.res.ColorStateList;
  4. import android.content.res.Resources;
  5. import android.content.res.TypedArray;
  6. import android.graphics.Bitmap;
  7. import android.graphics.drawable.Drawable;
  8. import android.graphics.drawable.LayerDrawable;
  9. import android.net.Uri;
  10. import android.util.AttributeSet;
  11. import android.util.Log;
  12. import android.widget.ImageView;
  13. @SuppressWarnings(“UnusedDeclaration”)
  14. public class RoundedImageView extends ImageView {
  15. public static final String TAG = “RoundedImageView”;
  16. public static final float DEFAULT_RADIUS = 0f;
  17. public static final float DEFAULT_BORDER_WIDTH = 0f;
  18. private static final ScaleType[] SCALE_TYPES = {
  19. ScaleType.MATRIX,
  20. ScaleType.FIT_XY,
  21. ScaleType.FIT_START,
  22. ScaleType.FIT_CENTER,
  23. ScaleType.FIT_END,
  24. ScaleType.CENTER,
  25. ScaleType.CENTER_CROP,
  26. ScaleType.CENTER_INSIDE
  27. };
  28. private float cornerRadius = DEFAULT_RADIUS;
  29. private float borderWidth = DEFAULT_BORDER_WIDTH;
  30. private ColorStateList borderColor =
  31. ColorStateList.valueOf(RoundedDrawable.DEFAULT_BORDER_COLOR);
  32. private boolean isOval = false;
  33. private boolean mutateBackground = false;
  34. private int mResource;
  35. private Drawable mDrawable;
  36. private Drawable mBackgroundDrawable;
  37. private ScaleType mScaleType;
  38. public RoundedImageView(Context context) {
  39. super(context);
  40. }
  41. public RoundedImageView(Context context, AttributeSet attrs) {
  42. this(context, attrs, 0);
  43. }
  44. public RoundedImageView(Context context, AttributeSet attrs, int defStyle) {
  45. super(context, attrs, defStyle);
  46. TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.RoundedImageView, defStyle, 0);
  47. int index = a.getInt(R.styleable.RoundedImageView_android_scaleType, -1);
  48. if (index >= 0) {
  49. setScaleType(SCALE_TYPES[index]);
  50. } else {
  51. // default scaletype to FIT_CENTER
  52. setScaleType(ScaleType.FIT_CENTER);
  53. }
  54. cornerRadius = a.getDimensionPixelSize(R.styleable.RoundedImageView_corner_radius, -1);
  55. borderWidth = a.getDimensionPixelSize(R.styleable.RoundedImageView_border_width, -1);
  56. // don’t allow negative values for radius and border
  57. if (cornerRadius < 0) {
  58. cornerRadius = DEFAULT_RADIUS;
  59. }
  60. if (borderWidth < 0) {
  61. borderWidth = DEFAULT_BORDER_WIDTH;
  62. }
  63. borderColor = a.getColorStateList(R.styleable.RoundedImageView_border_color);
  64. if (borderColor == null) {
  65. borderColor = ColorStateList.valueOf(RoundedDrawable.DEFAULT_BORDER_COLOR);
  66. }
  67. mutateBackground = a.getBoolean(R.styleable.RoundedImageView_mutate_background, false);
  68. isOval = a.getBoolean(R.styleable.RoundedImageView_oval, false);
  69. updateDrawableAttrs();
  70. updateBackgroundDrawableAttrs(true);
  71. a.recycle();
  72. }
  73. @Override
  74. protected void drawableStateChanged() {
  75. super.drawableStateChanged();
  76. invalidate();
  77. }
  78. /**
  79. * Return the current scale type in use by this ImageView.
  80. *
  81. * @attr ref android.R.styleable#ImageView_scaleType
  82. * @see android.widget.ImageView.ScaleType
  83. */
  84. @Override
  85. public ScaleType getScaleType() {
  86. return mScaleType;
  87. }
  88. /**
  89. * Controls how the image should be resized or moved to match the size
  90. * of this ImageView.
  91. *
  92. * @param scaleType The desired scaling mode.
  93. * @attr ref android.R.styleable#ImageView_scaleType
  94. */
  95. @Override
  96. public void setScaleType(ScaleType scaleType) {
  97. assert scaleType != null;
  98. if (mScaleType != scaleType) {
  99. mScaleType = scaleType;
  100. switch (scaleType) {
  101. case CENTER:
  102. case CENTER_CROP:
  103. case CENTER_INSIDE:
  104. case FIT_CENTER:
  105. case FIT_START:
  106. case FIT_END:
  107. case FIT_XY:
  108. super.setScaleType(ScaleType.FIT_XY);
  109. break;
  110. default:
  111. super.setScaleType(scaleType);
  112. break;
  113. }
  114. updateDrawableAttrs();
  115. updateBackgroundDrawableAttrs(false);
  116. invalidate();
  117. }
  118. }
  119. @Override
  120. public void setImageDrawable(Drawable drawable) {
  121. mResource = 0;
  122. mDrawable = RoundedDrawable.fromDrawable(drawable);
  123. updateDrawableAttrs();
  124. super.setImageDrawable(mDrawable);
  125. }
  126. @Override
  127. public void setImageBitmap(Bitmap bm) {
  128. mResource = 0;
  129. mDrawable = RoundedDrawable.fromBitmap(bm);
  130. updateDrawableAttrs();
  131. super.setImageDrawable(mDrawable);
  132. }
  133. @Override
  134. public void setImageResource(int resId) {
  135. if (mResource != resId) {
  136. mResource = resId;
  137. mDrawable = resolveResource();
  138. updateDrawableAttrs();
  139. super.setImageDrawable(mDrawable);
  140. }
  141. }
  142. @Override public void setImageURI(Uri uri) {
  143. super.setImageURI(uri);
  144. setImageDrawable(getDrawable());
  145. }
  146. private Drawable resolveResource() {
  147. Resources rsrc = getResources();
  148. if (rsrc == null) { return null; }
  149. Drawable d = null;
  150. if (mResource != 0) {
  151. try {
  152. d = rsrc.getDrawable(mResource);
  153. } catch (Exception e) {
  154. Log.w(TAG, ”Unable to find resource: ” + mResource, e);
  155. // Don’t try again.
  156. mResource = 0;
  157. }
  158. }
  159. return RoundedDrawable.fromDrawable(d);
  160. }
  161. @Override
  162. public void setBackground(Drawable background) {
  163. setBackgroundDrawable(background);
  164. }
  165. private void updateDrawableAttrs() {
  166. updateAttrs(mDrawable);
  167. }
  168. private void updateBackgroundDrawableAttrs(boolean convert) {
  169. if (mutateBackground) {
  170. if (convert) {
  171. mBackgroundDrawable = RoundedDrawable.fromDrawable(mBackgroundDrawable);
  172. }
  173. updateAttrs(mBackgroundDrawable);
  174. }
  175. }
  176. private void updateAttrs(Drawable drawable) {
  177. if (drawable == null) { return; }
  178. if (drawable instanceof RoundedDrawable) {
  179. ((RoundedDrawable) drawable)
  180. .setScaleType(mScaleType)
  181. .setCornerRadius(cornerRadius)
  182. .setBorderWidth(borderWidth)
  183. .setBorderColor(borderColor)
  184. .setOval(isOval);
  185. } else if (drawable instanceof LayerDrawable) {
  186. // loop through layers to and set drawable attrs
  187. LayerDrawable ld = ((LayerDrawable) drawable);
  188. for (int i = 0, layers = ld.getNumberOfLayers(); i < layers; i++) {
  189. updateAttrs(ld.getDrawable(i));
  190. }
  191. }
  192. }
  193. @Override
  194. @Deprecated
  195. public void setBackgroundDrawable(Drawable background) {
  196. mBackgroundDrawable = background;
  197. updateBackgroundDrawableAttrs(true);
  198. super.setBackgroundDrawable(mBackgroundDrawable);
  199. }
  200. public float getCornerRadius() {
  201. return cornerRadius;
  202. }
  203. public void setCornerRadius(int resId) {
  204. setCornerRadius(getResources().getDimension(resId));
  205. }
  206. public void setCornerRadius(float radius) {
  207. if (cornerRadius == radius) { return; }
  208. cornerRadius = radius;
  209. updateDrawableAttrs();
  210. updateBackgroundDrawableAttrs(false);
  211. }
  212. public float getBorderWidth() {
  213. return borderWidth;
  214. }
  215. public void setBorderWidth(int resId) {
  216. setBorderWidth(getResources().getDimension(resId));
  217. }
  218. public void setBorderWidth(float width) {
  219. if (borderWidth == width) { return; }
  220. borderWidth = width;
  221. updateDrawableAttrs();
  222. updateBackgroundDrawableAttrs(false);
  223. invalidate();
  224. }
  225. public int getBorderColor() {
  226. return borderColor.getDefaultColor();
  227. }
  228. public void setBorderColor(int color) {
  229. setBorderColor(ColorStateList.valueOf(color));
  230. }
  231. public ColorStateList getBorderColors() {
  232. return borderColor;
  233. }
  234. public void setBorderColor(ColorStateList colors) {
  235. if (borderColor.equals(colors)) { return; }
  236. borderColor =
  237. (colors != null) ? colors : ColorStateList.valueOf(RoundedDrawable.DEFAULT_BORDER_COLOR);
  238. updateDrawableAttrs();
  239. updateBackgroundDrawableAttrs(false);
  240. if (borderWidth > 0) {
  241. invalidate();
  242. }
  243. }
  244. public boolean isOval() {
  245. return isOval;
  246. }
  247. public void setOval(boolean oval) {
  248. isOval = oval;
  249. updateDrawableAttrs();
  250. updateBackgroundDrawableAttrs(false);
  251. invalidate();
  252. }
  253. public boolean isMutateBackground() {
  254. return mutateBackground;
  255. }
  256. public void setMutateBackground(boolean mutate) {
  257. if (mutateBackground == mutate) { return; }
  258. mutateBackground = mutate;
  259. updateBackgroundDrawableAttrs(true);
  260. invalidate();
  261. }
  262. }

package com.makeramen;import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.LayerDrawable;
import android.net.Uri;
import android.util.AttributeSet;
import android.util.Log;
import android.widget.ImageView;@SuppressWarnings("UnusedDeclaration")
public class RoundedImageView extends ImageView {public static final String TAG = "RoundedImageView";public static final float DEFAULT_RADIUS = 0f;public static final float DEFAULT_BORDER_WIDTH = 0f;private static final ScaleType[] SCALE_TYPES = {ScaleType.MATRIX,ScaleType.FIT_XY,ScaleType.FIT_START,ScaleType.FIT_CENTER,ScaleType.FIT_END,ScaleType.CENTER,ScaleType.CENTER_CROP,ScaleType.CENTER_INSIDE};private float cornerRadius = DEFAULT_RADIUS;private float borderWidth = DEFAULT_BORDER_WIDTH;private ColorStateList borderColor =ColorStateList.valueOf(RoundedDrawable.DEFAULT_BORDER_COLOR);private boolean isOval = false;private boolean mutateBackground = false;private int mResource;private Drawable mDrawable;private Drawable mBackgroundDrawable;private ScaleType mScaleType;public RoundedImageView(Context context) {super(context);}public RoundedImageView(Context context, AttributeSet attrs) {this(context, attrs, 0);}public RoundedImageView(Context context, AttributeSet attrs, int defStyle) {super(context, attrs, defStyle);TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.RoundedImageView, defStyle, 0);int index = a.getInt(R.styleable.RoundedImageView_android_scaleType, -1);if (index >= 0) {setScaleType(SCALE_TYPES[index]);} else {// default scaletype to FIT_CENTERsetScaleType(ScaleType.FIT_CENTER);}cornerRadius = a.getDimensionPixelSize(R.styleable.RoundedImageView_corner_radius, -1);borderWidth = a.getDimensionPixelSize(R.styleable.RoundedImageView_border_width, -1);// don't allow negative values for radius and borderif (cornerRadius < 0) {cornerRadius = DEFAULT_RADIUS;}if (borderWidth < 0) {borderWidth = DEFAULT_BORDER_WIDTH;}borderColor = a.getColorStateList(R.styleable.RoundedImageView_border_color);if (borderColor == null) {borderColor = ColorStateList.valueOf(RoundedDrawable.DEFAULT_BORDER_COLOR);}mutateBackground = a.getBoolean(R.styleable.RoundedImageView_mutate_background, false);isOval = a.getBoolean(R.styleable.RoundedImageView_oval, false);updateDrawableAttrs();updateBackgroundDrawableAttrs(true);a.recycle();}@Overrideprotected void drawableStateChanged() {super.drawableStateChanged();invalidate();}/*** Return the current scale type in use by this ImageView.** @attr ref android.R.styleable#ImageView_scaleType* @see android.widget.ImageView.ScaleType*/@Overridepublic ScaleType getScaleType() {return mScaleType;}/*** Controls how the image should be resized or moved to match the size* of this ImageView.** @param scaleType The desired scaling mode.* @attr ref android.R.styleable#ImageView_scaleType*/@Overridepublic void setScaleType(ScaleType scaleType) {assert scaleType != null;if (mScaleType != scaleType) {mScaleType = scaleType;switch (scaleType) {case CENTER:case CENTER_CROP:case CENTER_INSIDE:case FIT_CENTER:case FIT_START:case FIT_END:case FIT_XY:super.setScaleType(ScaleType.FIT_XY);break;default:super.setScaleType(scaleType);break;}updateDrawableAttrs();updateBackgroundDrawableAttrs(false);invalidate();}}@Overridepublic void setImageDrawable(Drawable drawable) {mResource = 0;mDrawable = RoundedDrawable.fromDrawable(drawable);updateDrawableAttrs();super.setImageDrawable(mDrawable);}@Overridepublic void setImageBitmap(Bitmap bm) {mResource = 0;mDrawable = RoundedDrawable.fromBitmap(bm);updateDrawableAttrs();super.setImageDrawable(mDrawable);}@Overridepublic void setImageResource(int resId) {if (mResource != resId) {mResource = resId;mDrawable = resolveResource();updateDrawableAttrs();super.setImageDrawable(mDrawable);}}@Override public void setImageURI(Uri uri) {super.setImageURI(uri);setImageDrawable(getDrawable());}private Drawable resolveResource() {Resources rsrc = getResources();if (rsrc == null) { return null; }Drawable d = null;if (mResource != 0) {try {d = rsrc.getDrawable(mResource);} catch (Exception e) {Log.w(TAG, "Unable to find resource: " + mResource, e);// Don't try again.mResource = 0;}}return RoundedDrawable.fromDrawable(d);}@Overridepublic void setBackground(Drawable background) {setBackgroundDrawable(background);}private void updateDrawableAttrs() {updateAttrs(mDrawable);}private void updateBackgroundDrawableAttrs(boolean convert) {if (mutateBackground) {if (convert) {mBackgroundDrawable = RoundedDrawable.fromDrawable(mBackgroundDrawable);}updateAttrs(mBackgroundDrawable);}}private void updateAttrs(Drawable drawable) {if (drawable == null) { return; }if (drawable instanceof RoundedDrawable) {((RoundedDrawable) drawable).setScaleType(mScaleType).setCornerRadius(cornerRadius).setBorderWidth(borderWidth).setBorderColor(borderColor).setOval(isOval);} else if (drawable instanceof LayerDrawable) {// loop through layers to and set drawable attrsLayerDrawable ld = ((LayerDrawable) drawable);for (int i = 0, layers = ld.getNumberOfLayers(); i < layers; i++) {updateAttrs(ld.getDrawable(i));}}}@Override@Deprecatedpublic void setBackgroundDrawable(Drawable background) {mBackgroundDrawable = background;updateBackgroundDrawableAttrs(true);super.setBackgroundDrawable(mBackgroundDrawable);}public float getCornerRadius() {return cornerRadius;}public void setCornerRadius(int resId) {setCornerRadius(getResources().getDimension(resId));}public void setCornerRadius(float radius) {if (cornerRadius == radius) { return; }cornerRadius = radius;updateDrawableAttrs();updateBackgroundDrawableAttrs(false);}public float getBorderWidth() {return borderWidth;}public void setBorderWidth(int resId) {setBorderWidth(getResources().getDimension(resId));}public void setBorderWidth(float width) {if (borderWidth == width) { return; }borderWidth = width;updateDrawableAttrs();updateBackgroundDrawableAttrs(false);invalidate();}public int getBorderColor() {return borderColor.getDefaultColor();}public void setBorderColor(int color) {setBorderColor(ColorStateList.valueOf(color));}public ColorStateList getBorderColors() {return borderColor;}public void setBorderColor(ColorStateList colors) {if (borderColor.equals(colors)) { return; }borderColor =(colors != null) ? colors : ColorStateList.valueOf(RoundedDrawable.DEFAULT_BORDER_COLOR);updateDrawableAttrs();updateBackgroundDrawableAttrs(false);if (borderWidth > 0) {invalidate();}}public boolean isOval() {return isOval;}public void setOval(boolean oval) {isOval = oval;updateDrawableAttrs();updateBackgroundDrawableAttrs(false);invalidate();}public boolean isMutateBackground() {return mutateBackground;}public void setMutateBackground(boolean mutate) {if (mutateBackground == mutate) { return; }mutateBackground = mutate;updateBackgroundDrawableAttrs(true);invalidate();}
}

小记: 太方便了  真心感谢开源者

每日精进一点点  谢谢

RoundedImageView的使用相关推荐

  1. android开源项目---RoundedImageView制作圆角矩形,椭圆形以其圆形控件

    一.项目概述 在项目中美工提供给我们的图片通常是矩形的,我们如何把矩形的图片做成圆角矩形.椭圆形以其圆形效果的图形显示效果,这就是我这篇文章要讲的内容. 效果如下: 我这里使用的是开源项目  Roun ...

  2. Android 第三方RoundedImageView设置各种圆形、方形头像

    Android 自定义CoolImageView实现QQ首页背景图片动画效果 一.第三方RoundedImageView 1.在Android Studio中,可进入模块设置中添加库依赖. 进入Mod ...

  3. RoundedImageView 处理图片存在毛边的问题

    现在用户的头像都是圆形的,所以大家都会用到圆形imageView 或者用第三方框架 直接处理.我这里是用的RoundedImageView,但是在处理的时候,发现一个问题,就是加载网络图片的时候完全没 ...

  4. RoundedImageView使用Glid加载图片

    RoundedImageView使用Glid加载图片,设置了riv_corner_radius没有得到圆角效果,各种测试之后,发现只有第一次加载会不圆角,很尴尬,最后设置了asBitMap(),问题解 ...

  5. RoundedImageView设置各种圆形、方形头像

    一.第三方RoundedImageView 1.在Android Studio中,可进入模块设置中添加库依赖. 进入Module结构设置添加库依赖 ,输入RoundedImageView然后搜索添加 ...

  6. 第三波精品Android源码袭来!免费下载

    今天又汇总了一些源码供大家免费下载学习! 1.Android实现NewQuickAction快捷菜单 NewQuickAction能根据点击事件发生的坐标来显示一个快捷菜单,比如点击位置在靠近底部,则 ...

  7. Android开源项目分类汇总-转载

    太长了,还是转载吧... 今天在看博客的时候,无意中发现了@Trinea在GitHub上的一个项目Android开源项目分类汇总,由于类容太多了,我没有一个个完整地看完,但是里面介绍的开源项目都非常有 ...

  8. Glide 这样用,更省内存

    本文讲的是Glide 这样用,更省内存, 一.前言 Glide 是 Google 官方推荐的一款图片加载库,使用起来也非常的简单便利,Glide 它帮我们完成了很多很重要,但是却通用的功能,例如:图片 ...

  9. android studio 单步调试jni,android studio实现Jni单步调试-标准配置教程

    本文主要介绍在android studio下实现jni单步调试时,所需要的配置及其步骤,这些也是本人经过几天折腾慢慢实现的,先提供给大家做参考: 1,配置是在mac下android studio实现的 ...

最新文章

  1. 微信公众号数据2019_公众号年度数据报告怎么写?2019年公众号年报可一键生成啦!...
  2. 开发日记-20190803 关键词 读书笔记《Linux 系统管理技术手册(第二版)》DAY 19
  3. Nature:中国正在上演AI人才争夺战,中国公司在与Google竞争
  4. 灵魂拷问,上 Kubernetes 有什么业务价值?
  5. 实战|Python轻松实现动态网页爬虫(附详细源码)
  6. 运行错误:Application Error - The connection to the server was unsuccessful
  7. 数字图像处理之图像基础
  8. 无连接网络通信程序UDP
  9. carmaker/matlab联合仿真(三) 生成车道线点,拟合多项式方程
  10. html5用户注册页面代码,HTML5注册页面示例代码
  11. 信息与网络安全基础知识汇总
  12. 12款自动生成器,无聊人士自娱自乐专用
  13. ArcGIS中的 .tpk数据
  14. 金融信贷风控中的机器学习
  15. 面试题,互联网产品的盈利模式有哪些?
  16. aardio - 虚表库全新升级,支持图片系列专题
  17. win10电脑右击新建没有Word、Excel怎么办
  18. 日语蔬菜水果相关词汇(2)
  19. 两种“猿” 两个生活
  20. Mysql启动时pid未更新_MySQL启动报错 无法更新PID文件

热门文章

  1. SpyNote5.0 Client_APK逆向分析
  2. 没有mysql不能设置root密码怎么办_无法给MySQL root用户修改密码的解决方法
  3. 一图抵千言《ARouter简明扼要原理分析》
  4. Ice飞冰《配置总结》
  5. mybatis sql 改写
  6. win10启动虚拟机蓝屏的一种解决方法
  7. 程序员的插画成长之路并不平坦
  8. 计算机系表白祖国母亲,青春向祖国告白——“给祖国母亲的一封告白信”活动纪实...
  9. 爬取公众号的文章,同时处理图片不显示问题(JAVA)
  10. 基于opencv和pillow实现人脸识别系统(附demo)