Android theme功能临时存放

Posted 蚁人日记

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Android theme功能临时存放相关的知识,希望对你有一定的参考价值。

this.getExternalFilesDir(Environment.DIRECTORY_PICTURES).getPath();对应路径
@NonNull
private Bitmap getBitmapFromDrawable(@NonNull Drawable drawable) 
    final Bitmap bmp = Bitmap.createBitmap(drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
    final Canvas canvas = new Canvas(bmp);
    drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
    drawable.draw(canvas);
    return bmp;

【icon_mask.png】图像蒙板(黑色区域图像全部透过,边缘空白区域被屏蔽不显示,从而将不规则图标统一大小和形状)
【icon_border.png】图标饰边层(其实也是图像蒙板),盖在原图标上,通过半透效果或饰边,增加图标的个性
【icon_background_01.png】图标背景,用来填满图标空白区域,但是依然会有不听话的图标,就是不爱穿衣服!

/storage/emulated/0/android/data/com.example.testpplication/files/Pictures

   public void  getScreenWidthAndHeight(Context context)
      this.heightPixels = context.getResources().getDisplayMetrics().heightPixels / 2 + 50;
      this.widthPixels  = context.getResources().getDisplayMetrics().widthPixels  /3 - 10;
   
public  Bitmap getimage(InputStream bitmapIS) 
   BitmapFactory.Options newOpts = new BitmapFactory.Options();
   newOpts.inJustDecodeBounds = true;
   Bitmap bitmap = BitmapFactory.decodeStream(bitmapIS,null, newOpts);
   final int height = newOpts.outWidth;
   final int width = newOpts.outHeight;
   int inSampleSize = 1;
   if (height > heightPixels || width > widthPixels) 
      final int heightRatio = Math.round((float) height / (float) heightPixels);
      final int widthRatio = Math.round((float) width / (float) widthPixels);
      inSampleSize = heightRatio < widthRatio ? heightRatio : widthRatio;
   
   newOpts.inSampleSize = inSampleSize;// 设置缩放比例
   newOpts.inJustDecodeBounds = false;
   bitmap = BitmapFactory.decodeStream(bitmapIS,null, newOpts);
   return bitmap;


public  Bitmap getBitmap(Bitmap orightBitmap, float prevW, float prevH)

   int mWidth=orightBitmap.getWidth();
   int mHeight=orightBitmap.getHeight();
   float scaleW=(float)prevW/mWidth;
   float scaleH=(float)prevH/mHeight;
   Matrix scaleMatrix = new Matrix();
   scaleMatrix.postScale(scaleW, scaleH);
   Bitmap resizeBmp = Bitmap.createBitmap(orightBitmap, 0, 0, mWidth,mHeight, scaleMatrix, true);
   return resizeBmp;
Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES).getPath();

以上是关于Android theme功能临时存放的主要内容,如果未能解决你的问题,请参考以下文章

Android theme功能临时存放

Android主题切换(Theme)实现日夜间功能

Android主题切换(Theme)实现日夜间功能

初学Linux-3.系统目录功能

Linux操作系统各目录功能

(Android UI)Action Bar