WebMar 14, 2024 · My code for getting height of image and imageview: int imagWidth = imageView.getWidth (); int h = imageView.getHeight (); int w = imageView.getDrawable ().getIntrinsicWidth (); int imagHeight = imageView.getDrawable ().getIntrinsicHeight (); Log.e ("height", "Image height" + imagHeight + "\n" + "Imageview height" + h); WebSep 17, 2012 · Further explanation: as usual we check wheter the picture is taller than wide (expanded the height of the picture should match the height of expandedImageView) or vice versa. Then we check if the picture in the original (smaller) ImageView (thumbView) is matching the width or the heigth, so we can adjust for the space.
How to get the height and width of the android widget …
WebFeb 9, 2016 · Efficient way to get Width & Height of Drawable: Drawable drawable = getResources ().getDrawable (R.drawable.ic_home); int width = drawable.getIntrinsicWidth (); int height = drawable.getIntrinsicHeight (); Log.i ("Drawable dimension : W-H", width+"-"+height); Hope this will help you. Share Follow answered Feb 9, 2016 at 12:48 Hiren Patel WebJul 3, 2024 · This example demonstrates how do I get the height and width of the android.widget.ImageView in android. Step 1 − Create a new project in Android … simplify 80 over 100
can i get image file width and height from uri in android?
WebJul 3, 2024 · This example demonstrates how do I get the height and width of the android.widget.ImageView in android. Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project. Step 2 − Add the following code to res/layout/activity_main.xml. WebMar 21, 2012 · This can be done using LayoutParams to dynamically set the Views height once your know the Views width at runtime. You need to use a Runnable thread in order to get the Views width at runtime or else you'll be trying to set the Height before you know the View's width because the layout hasn't been drawn yet. Example of how I solved my … WebMay 21, 2024 · I am having problem with displaying images correctly in my application. I would like the size of the imageView to adapt to the size of the image, so I need to read the height and width of the image downloaded from the server using Picasso. I've tried various solutions from other threads on StackOverflow, but unfortunately none of them worked. raymond stephens md