Android theme功能临时存放
Posted 蚁人日记
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Android theme功能临时存放相关的知识,希望对你有一定的参考价值。
this.getExternalFilesDir(Environment.DIRECTORY_PICTURES).getPath();对应路径
/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功能临时存放的主要内容,如果未能解决你的问题,请参考以下文章
Xamarin.Android WebView App性能问题