Questions tagged [android-imageview]

Displays an arbitrary image or a drawable, such as an icon or an xml defined graphical element.

Displays an arbitrary image, such as an icon. The ImageView class can load images from various sources (such as resources or content providers) and it will take care of computing its measurement from the image so that it can be used in any layout manager. It also provides various display options such as scaling and tinting.

More information can be found in the documentation for the ImageView class.

4273 questions
146
votes
11 answers

Android Camera : data intent returns null

I have an android application which contains multiple activities. In one of them I'm using a button which will call the device camera : public void onClick(View view) { Intent photoIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); …
soft_developer
  • 1,499
  • 2
  • 11
  • 9
137
votes
23 answers

Android ImageView Zoom-in and Zoom-Out

I want to Zoom-in and Zoom-out an Android ImageView. I tried most of the samples but in all of them the image in the ImageView itself is getting Zoomed-in and Zoomed-out, while I want to Zoom-in and Zoom-out the ImageView. I want to increase the…
karthi
  • 1,383
  • 2
  • 10
  • 5
100
votes
9 answers

Android Text over image

I have an imageView with an image, over that image I want to place a text. How can I achieve that?
AndyAndroid
  • 4,039
  • 14
  • 44
  • 71
96
votes
10 answers

How to download and save an image in Android

How do you download and save an image from a given url in Android?
Droidman
  • 11,485
  • 17
  • 93
  • 141
88
votes
7 answers

Android ImageView: Fit Width

I download image and set it as a screen background dynamically using Imageview. I have tried ScaleType, to scale the image. If image height is larger than width then ScaleTypes fitStart, fitEnd and fitCenter don't work. Android scale down the photo…
Sharjeel
  • 15,588
  • 14
  • 58
  • 89
79
votes
6 answers

Scale an image up to fill entire ImageView in Android

I'd like to scale an image up to take up the entire size of an ImageView. This is subtly different than using scaleType=fit_center because fit_center will leave bands around the image if the image aspect ratio does not exactly match the ImageView's…
emmby
  • 99,783
  • 65
  • 191
  • 249
79
votes
5 answers

Maximum width and height for ImageView in Android

So I have an ImageView set with android:maxHeight="100px" android:maxWidth="250px" android:minHeight="100px" android:minWidth="250px" android:scaleType="centerInside" This image view is used to show a picture that is obtained from the gallery or…
Miguel Ribeiro
  • 8,057
  • 20
  • 51
  • 74
72
votes
7 answers

Get the ID of a drawable in ImageView

I have one ImageView and set a drawable on it. Now I need to get the ID of the drawable on click event of ImageView dynamically. How can I get it? imgtopcolor = (ImageView) findViewById(R.id.topcolor); imgtopcolor.setImageResource(R.drawable.dr); …
chikka.anddev
  • 9,569
  • 7
  • 38
  • 46
69
votes
4 answers

Show ImageView programmatically

How can I make an ImageView appear in the middle of the screen when the user clicks a button? I have placed the image in the res/drawable-folder. I've been trying with the code below but I don't know how to make the ImageView appear: View v = new…
erdomester
  • 11,789
  • 32
  • 132
  • 234
60
votes
4 answers

When it's necessary to execute invalidate() on a View?

My answer to this question was just accepted but I started to wonder when exactly one needs to invalidate() a View and when it is not necessary? After a bit of thinking I came to realization that it should work more or less like this: actual…
mjaskowski
  • 1,479
  • 1
  • 12
  • 16
57
votes
7 answers

Android Image Dialog/Popup

Is it possible to have just an image popup/come-up in an Android application? It's similar to an overriding the normal view of an AlertDialog so that it contains just an image and nothing else. SOLUTION: I was able to find an answer thanks to…
Abhijit
  • 4,853
  • 3
  • 30
  • 33
56
votes
7 answers

Android ImageView Fixing Image Size

I have an Android Application, where I have an ImageView, I need to keep the size constant, there can be various images that I need to put into this ImageView, of different sizes. I just need to ensure that all the Images must fit into the…
Shalabh
  • 687
  • 1
  • 6
  • 11
55
votes
7 answers

Add gradient to imageview

I want to add a gradient on the bottom of my image . Something like this : I tried something like this but I only get the gradient no image..
user1163234
  • 2,407
  • 6
  • 35
  • 63
55
votes
6 answers

How to check which current image resource is attached to ImageView in android xml?

I want to check which image resource is attached to ImageView in xml, I am able to check that which image resource is attached to image view but my requirement is to how to check that the ImageView has the same resource which I have set into xml or…
Reena
  • 1,368
  • 1
  • 11
  • 25
52
votes
7 answers

Placing a textview on top of imageview in android

I have a listview, that has a single imageview which is scrollable vertically I am trying to place a textview on top of Imageview Both the views must be visible Is it possible ? If yes, How to do it programmatically ? What changes should i need…
user2609157