¡@

Home 

2014/10/16 ¤W¤È 08:12:19

android Programming Glossary: desiredwidth

onMeasure custom view explanation

http://stackoverflow.com/questions/12266899/onmeasure-custom-view-explanation

onMeasure int widthMeasureSpec int heightMeasureSpec int desiredWidth 100 int desiredHeight 100 int widthMode MeasureSpec.getMode.. MeasureSpec.AT_MOST Can't be bigger than... width Math.min desiredWidth widthSize else Be whatever you want width desiredWidth Measure.. desiredWidth widthSize else Be whatever you want width desiredWidth Measure Height if heightMode MeasureSpec.EXACTLY Must be this..

Quality problems when resizing an image at runtime

http://stackoverflow.com/questions/4231817/quality-problems-when-resizing-an-image-at-runtime

srcHeight options.outHeight int scale 1 while srcWidth 2 desiredWidth srcWidth 2 srcHeight 2 scale 2 options.inJustDecodeBounds false.. scaledBitmap Bitmap.createScaledBitmap sampledSrcBitmap desiredWidth desiredHeight false Lastly the new resized image is saved to.. is just trying to fit a image into a certain width. if desiredWidth srcWidth desiredWidth srcWidth Calculate the correct inSampleSize..

onMeasure custom view explanation

http://stackoverflow.com/questions/12266899/onmeasure-custom-view-explanation

is as simple as something like this @Override protected void onMeasure int widthMeasureSpec int heightMeasureSpec int desiredWidth 100 int desiredHeight 100 int widthMode MeasureSpec.getMode widthMeasureSpec int widthSize MeasureSpec.getSize widthMeasureSpec.. Must be this size width widthSize else if widthMode MeasureSpec.AT_MOST Can't be bigger than... width Math.min desiredWidth widthSize else Be whatever you want width desiredWidth Measure Height if heightMode MeasureSpec.EXACTLY Must be this size.. MeasureSpec.AT_MOST Can't be bigger than... width Math.min desiredWidth widthSize else Be whatever you want width desiredWidth Measure Height if heightMode MeasureSpec.EXACTLY Must be this size height heightSize else if heightMode MeasureSpec.AT_MOST..

Quality problems when resizing an image at runtime

http://stackoverflow.com/questions/4231817/quality-problems-when-resizing-an-image-at-runtime

imageFilePathString options int srcWidth options.outWidth int srcHeight options.outHeight int scale 1 while srcWidth 2 desiredWidth srcWidth 2 srcHeight 2 scale 2 options.inJustDecodeBounds false options.inDither false options.inSampleSize scale Bitmap.. options Then I am doing the actual scaling with Bitmap scaledBitmap Bitmap.createScaledBitmap sampledSrcBitmap desiredWidth desiredHeight false Lastly the new resized image is saved to disk with FileOutputStream out new FileOutputStream newFilePathString.. Only scale if the source is big enough. This code is just trying to fit a image into a certain width. if desiredWidth srcWidth desiredWidth srcWidth Calculate the correct inSampleSize scale value. This helps reduce memory use. It should be..