发布网友 发布时间:2022-04-23 09:46
共2个回答
热心网友 时间:2023-10-10 00:23
先把这个图片转成bitmap,然后把这个bitmap转成圆角Bitmap,然后把这个圆角bitmap设置成textview的背景,下面是相应的代码,希望对你能有帮助,不用谢了public static Bitmap getRoundedCornerBitmap(Bitmap bitmap,int roundPixelSize) { Bitmap output = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), Config.ARGB_8888); Canvas canvas = new Canvas(output); final Paint paint = new Paint(); final Rect rect = new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight()); final RectF rectF = new RectF(rect); final float roundPx = roundPixelSize; paint.setAntiAlias(true); canvas.drawRoundRect(rectF,roundPx,roundPx, paint); paint.setXfermode(new PorterDuffXfermode(Mode.SRC_IN)); canvas.drawBitmap(bitmap, rect, rect, paint); return output; }
热心网友 时间:2023-10-10 00:24
找到相应的代码就好了 你可以去后盾网看看 希望可以帮助到你 望采纳