android Programming Glossary: finalwidth
How to get the Dimensions of a Drawable in an ImageView? http://stackoverflow.com/questions/4649438/how-to-get-the-dimensions-of-a-drawable-in-an-imageview Just tried this out and it works for me int finalHeight finalWidth final ImageView iv ImageView findViewById R.id.scaled_image.. public boolean onPreDraw finalHeight iv.getMeasuredHeight finalWidth iv.getMeasuredWidth tv.setText Height finalHeight Width finalWidth.. iv.getMeasuredWidth tv.setText Height finalHeight Width finalWidth return true The ViewTreeObserver will let you monitor the layout..
android get height width of ImageView http://stackoverflow.com/questions/4680499/android-get-height-width-of-imageview My answer on this question might help you int finalHeight finalWidth final ImageView iv ImageView findViewById R.id.scaled_image.. public boolean onPreDraw finalHeight iv.getMeasuredHeight finalWidth iv.getMeasuredWidth tv.setText Height finalHeight Width finalWidth.. iv.getMeasuredWidth tv.setText Height finalHeight Width finalWidth return true You can then add your image scaling work from within..
Fixed aspect ratio View http://stackoverflow.com/questions/7058507/fixed-aspect-ratio-view originalWidth mAspectRatioHeight mAspectRatioWidth int finalWidth finalHeight if calculatedHeight originalHeight finalWidth originalHeight.. finalWidth finalHeight if calculatedHeight originalHeight finalWidth originalHeight mAspectRatioWidth mAspectRatioHeight finalHeight.. mAspectRatioHeight finalHeight originalHeight else finalWidth originalWidth finalHeight calculatedHeight super.onMeasure..
How to get the Dimensions of a Drawable in an ImageView? http://stackoverflow.com/questions/4649438/how-to-get-the-dimensions-of-a-drawable-in-an-imageview android imageview dimensions share improve this question Just tried this out and it works for me int finalHeight finalWidth final ImageView iv ImageView findViewById R.id.scaled_image final TextView tv TextView findViewById R.id.size_label ViewTreeObserver.. new ViewTreeObserver.OnPreDrawListener public boolean onPreDraw finalHeight iv.getMeasuredHeight finalWidth iv.getMeasuredWidth tv.setText Height finalHeight Width finalWidth return true The ViewTreeObserver will let you monitor.. boolean onPreDraw finalHeight iv.getMeasuredHeight finalWidth iv.getMeasuredWidth tv.setText Height finalHeight Width finalWidth return true The ViewTreeObserver will let you monitor the layout just prior to drawing it i.e. everything has been measured..
android get height width of ImageView http://stackoverflow.com/questions/4680499/android-get-height-width-of-imageview android image height width share improve this question My answer on this question might help you int finalHeight finalWidth final ImageView iv ImageView findViewById R.id.scaled_image final TextView tv TextView findViewById R.id.size_label ViewTreeObserver.. new ViewTreeObserver.OnPreDrawListener public boolean onPreDraw finalHeight iv.getMeasuredHeight finalWidth iv.getMeasuredWidth tv.setText Height finalHeight Width finalWidth return true You can then add your image scaling work..
Fixed aspect ratio View http://stackoverflow.com/questions/7058507/fixed-aspect-ratio-view MeasureSpec.getSize heightMeasureSpec int calculatedHeight originalWidth mAspectRatioHeight mAspectRatioWidth int finalWidth finalHeight if calculatedHeight originalHeight finalWidth originalHeight mAspectRatioWidth mAspectRatioHeight finalHeight.. originalWidth mAspectRatioHeight mAspectRatioWidth int finalWidth finalHeight if calculatedHeight originalHeight finalWidth originalHeight mAspectRatioWidth mAspectRatioHeight finalHeight originalHeight else finalWidth originalWidth finalHeight.. originalHeight finalWidth originalHeight mAspectRatioWidth mAspectRatioHeight finalHeight originalHeight else finalWidth originalWidth finalHeight calculatedHeight super.onMeasure MeasureSpec.makeMeasureSpec finalWidth MeasureSpec.EXACTLY..
|