Questions tagged [imageview]

Android widget that displays an arbitrary image or drawable, such as an icon.

9865 questions
71
votes
8 answers

How to set VectorDrawable as an image for ImageView programmatically

I want to set some vectorDrawables to a ImageView in Android Studio. I can set png and jpg drawable easily but when i want to set VectorDrawable, it does not work on imageview. img.setImageResource(R.drawable.ic_home); ic_home is VectorDrawable and…
Hamid Waezi
  • 878
  • 1
  • 7
  • 14
66
votes
6 answers

Android -- How to position View off-screen?

I'm trying to animate a simple ImageView in my application and I want it to slide in from the bottom of the screen and come to a resting position where the top 50px of the view is off the top of the screen (e.g. the final position of the ImageView…
RyanM
  • 5,680
  • 9
  • 45
  • 55
64
votes
7 answers

How to add a shadow and a border on circular imageView android?

I created a CircularImageView with this question: Create circular image view in android Download project on GitHub 1) This is the CircularImageView class : public class CircularImageView extends ImageView { public CircularImageView(Context…
lopez.mikhael
  • 9,943
  • 19
  • 67
  • 110
63
votes
7 answers

Grid of images inside ScrollView

I'm trying to create a screen with both text and images. I want the images to be laid out like a grid, as shown below, but I want them to have no scroll functionality other that the one provided by the surrounding ScrollView. An image will best…
hanspeide
  • 2,819
  • 4
  • 25
  • 33
62
votes
5 answers

Android ImageView adjusting parent's height and fitting width

Update : I solved this issue by using the method described in this answer I'm a bit stuck with this issue, which I think should be pretty simple. So my app downloads an image, and renders the bitmap in an ImageView, a child element of a…
Julien
  • 9,312
  • 10
  • 63
  • 86
62
votes
11 answers

Canvas: trying to use a recycled bitmap android.graphics.Bitmap in Android

I am working on the crop image class, but encounter a recycled bit map problem: 03-02 23:14:10.514: E/AndroidRuntime(16736): FATAL EXCEPTION: Thread-1470 03-02 23:14:10.514: E/AndroidRuntime(16736): java.lang.RuntimeException: Canvas: trying to use…
user782104
  • 13,233
  • 55
  • 172
  • 312
61
votes
2 answers

How do I resize an imageview image in javafx?

I need to resize an image to specific dimensions, 100 by 100 pixels for example, in JavaFX. How can I achieve that? Could the Image or the ImageView class be used for this purpose?
Jeremy
  • 613
  • 1
  • 5
  • 5
60
votes
7 answers

Android: java.lang.ClassCastException: android.widget.imageView cannot be cast to android.widget.textView

I can't fix this problem on my listview template: i have the error as in the title of my post, but i won't cast imageview to textview. Here's my code:
Release
  • 1,167
  • 1
  • 12
  • 21
57
votes
5 answers

Get Image from the Gallery and Show in ImageView

I need to get an image from the gallery on a button click and show it into the imageview. I am doing it in the following way: btn_image_button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v)…
Android Nerd
  • 625
  • 1
  • 8
  • 13
57
votes
9 answers

Adding text to ImageView in Android

I want to use an ImageView to show some message in a fancy way. How do I add text to an ImageView?
Shashi
  • 591
  • 1
  • 4
  • 6
57
votes
5 answers

Get Bitmap from ImageView in Android L

I want to get Bitmap from ImageView. I have used following code, but getDrawable() returns null. How to get whole Bitmap from ImageView. Bitmap bitmap; if (mImageViewer.getDrawable() instanceof BitmapDrawable) { bitmap = ((BitmapDrawable)…
Utkarsh Srivastav
  • 3,105
  • 7
  • 34
  • 53
56
votes
3 answers

Android RemoteViews, how to set ScaleType of an ImageView inside a widget?

I am developing a widget with an image on the rigth side, which can be choosen by the user in one of the settings screen. The image can then be set from the user with the ImageView.setScaleType("CENTER"). That works. The URL of the image is then…
user1013443
  • 798
  • 1
  • 8
  • 17
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
56
votes
13 answers

Android get image from gallery into ImageView

I'm trying to add a photo from galery to a ImageView but I get this error: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=1, result=-1, data=Intent { dat=content://media/external/images/media/1 }} to…
user1378505
  • 563
  • 1
  • 4
  • 5
54
votes
1 answer

ImageView in android XML layout with layout_height="wrap_content" has padding top & bottom

I have a vertical LinearLayout containing an ImageView and a few other layouts and views.
gsteinert
  • 1,324
  • 2
  • 10
  • 13