<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      圓角圖片2 RoundedBitmapDrawable 加載本地圖片

      • 參考博文

      1. Android 圓角圖片的實現(xiàn)         ——矩形圖片通過裁剪實現(xiàn)圓形圖片
      2. Android圓角圖片和圓形圖片實現(xiàn)總結   ——多種圓角圖片繪制方式

      3. android RoundedBitmapDrawable最簡單方式實現(xiàn)圓角圖片   ——RounedBitMapDrawable圖片顯示變形問題處理以及添加邊框

       

      • 效果演示(引用其他博文效果,實測如下)

        

      • 核心代碼

      ?矩形圖片 ivRectImg.setImageDrawable(bitmapDrawable);

      public static RoundedBitmapDrawable tranRoundBitmap(Context context,int drawableId) {
              Bitmap bitmap = BitmapFactory.decodeResource(context.getResources(),drawableId);
              RoundedBitmapDrawable bitmapDrawable = RoundedBitmapDrawableFactory.create(context.getResources(), bitmap);
              bitmapDrawable.setAntiAlias(true);
              bitmapDrawable.setCornerRadius(10); //控制圓角半徑
      //        ivRectImg.setImageDrawable(bitmapDrawable); //使用方法
              return bitmapDrawable;
      }

       

      圓形圖片 Bitmap.createBitmap 變形圖片的處理

      private void circleBitmap() {
           Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.mipmap.image_bg);
              Bitmap circle = null;
              int min = Math.min(width, height);
              int max = Math.max(width, height);
              if (width == height) {
                  circle = Bitmap.createBitmap(bitmap, 0, 0, width, height);
              } else {
                  // 居中裁剪
                  if (width > height) {
                      circle = Bitmap.createBitmap(bitmap, (max - min) / 2, 0, min, min);
                  } else {
                      circle = Bitmap.createBitmap(bitmap, 0, (max - min) / 2, min, min);
                  }
              }
              RoundedBitmapDrawable bitmapDrawable = RoundedBitmapDrawableFactory.create(getResources(), circle);
              bitmapDrawable.setCornerRadius(min / 2);
              bitmapDrawable.setAntiAlias(true);
              ivCircleImg.setImageDrawable(bitmapDrawable);
          }

       

      圓形圖片添加邊框 drawCircle (圓角矩形不統(tǒng)用)

              Canvas canvas = new Canvas(roundedBitmap);
              Paint borderPaint = new Paint();
              borderPaint.setStyle(Paint.Style.STROKE);
              borderPaint.setStrokeWidth(borderWidthHalf);
              borderPaint.setColor(Color.WHITE);
              //添加邊框
              canvas.drawCircle(canvas.getWidth()/2, canvas.getWidth()/2, newBitmapSquareWidth/2, borderPaint);    

       

      • 與GlideApp對比

        如果Android項目中僅少的使用圓角圖片且無需加載網(wǎng)絡圖片,此方法更為簡單合適,不需要添加依賴以及很多的代碼。GlideApp加載網(wǎng)絡圖片較為方便,以及一些內存緩存的機制。

       

      posted @ 2021-07-16 11:06  茄子魚  閱讀(218)  評論(0)    收藏  舉報
      主站蜘蛛池模板: 草草浮力影院| 日本免费人成视频在线观看| 国产精品亚洲精品日韩已满十八小| 欧洲熟妇色自偷自拍另类| 国语精品一区二区三区| 福海县| 日韩一本不卡一区二区三区| 精品无人区一区二区三区在线| 久久综合国产一区二区三区| 国产精品一区二区久久岳| 重口SM一区二区三区视频| 高清无码爆乳潮喷在线观看| 亚洲国产片一区二区三区| 国产精品自拍一二三四区| 国产精品免费视频不卡| 人妻中文字幕精品系列| 国产午夜影视大全免费观看| 亚洲欧美一区二区成人片| 亚洲精品日韩在线观看| 一本加勒比hezyo无码人妻| 亚洲欧美人成电影在线观看| 亚洲18禁私人影院| 亚洲av综合久久成人网| 亚洲精品中文字幕一区二| 国模粉嫩小泬视频在线观看| 无遮无挡爽爽免费视频| 91一区二区三区蜜桃臀| 大尺度国产一区二区视频| 日本亚洲色大成网站www久久| 国产永久免费高清在线观看| 4hu亚洲人成人无码网www电影首页| 国产蜜臀久久av一区二区| 色偷偷www.8888在线观看| 亚洲国产精品久久久天堂麻豆宅男| 精品无套挺进少妇内谢| 国产精品人一区二区三区| 国产午夜精品久久久久免费视| bt天堂新版中文在线| 人妻系列无码专区无码中出| 无码日韩做暖暖大全免费不卡| 人妻夜夜爽天天爽一区|