Questions tagged [imageview]

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

9865 questions
54
votes
3 answers

Android: resizing an ImageView in the XML

I have an image that is too big to fit on the screen, and I want it fairly small on screen. How do I change the size of the image through XML? I tried:
Mark Manickaraj
  • 1,661
  • 5
  • 28
  • 44
54
votes
7 answers

Glide listener doesn't work

I'm using Glide to load images and I added a listener to know when resource is ready or if there was an error of any type: Glide.with(mContext) .load(url) .placeholder(R.drawable.glide_placeholder) // use dontAnimate and not crossFade to…
Giorgio Antonioli
  • 15,771
  • 10
  • 45
  • 70
54
votes
3 answers

Rotate ImageView source from layout xml file

I have this ImageView in my layout:
mehrmoudi
  • 1,096
  • 1
  • 11
  • 22
53
votes
9 answers

Adding Fling Gesture to an image view - Android

Okay I have been referencing the code here: Fling gesture detection on grid layout but just can not get it to work. In my main activity I have a simple image defined. I want to detect a fling on the image. Here is my code below. The onclick method…
Ryan
  • 531
  • 1
  • 5
  • 3
52
votes
5 answers

RecyclerView 2 Columns with CardView

I have a problem with my layout. I'm trying to do something like this: For now, i have a RecyclerView with a CardView inside it. in the CardView I have put an ImageView and a TextView but I don't know why but the CardView is more height than…
52
votes
12 answers

Can't use srcCompat for ImageViews in android

I'm using the Design Support Library 23.2. I've added these lines in my build.gradle as my Gradle Plugin is version 1.5 defaultConfig { applicationId "com.abc.xyz" minSdkVersion 16 targetSdkVersion 23 versionCode…
Neeraj
  • 1,769
  • 3
  • 24
  • 41
51
votes
10 answers

setColorFilter not working

I'm trying to implement a simple colorfilter on an imageview to turn the black image into a white image. In order to achieve that I do the following: weatherImg.setColorFilter(Color.BLACK, PorterDuff.Mode.MULTIPLY); …
Tim Kranen
  • 4,202
  • 4
  • 26
  • 49
51
votes
12 answers

ImageView displaying in layout but not on actual device

I have an ImageView that I want to display matching the full width of the device, I realized that like this:
Tim Kranen
  • 4,202
  • 4
  • 26
  • 49
51
votes
13 answers

Bitmap in ImageView with rounded corners

I have an ImageView and I want to make it with rounded corners. I use this:
BoraBora
  • 565
  • 1
  • 4
  • 9
50
votes
3 answers

Apply Color Filter with xml in ImageView

I've got an ImageView and programmatically I can change its color using imageView.setColorFilter(Color.RED). There is something similar using xml??
Manuel Castro
  • 1,633
  • 3
  • 24
  • 38
49
votes
5 answers

Positioning an image inside an ImageView with gravity: top

╔════════════════════════════════════════════════════════╗ ║ Linear Layout (Center) ║ ║ ╔══════════════════════════════════════════════╗ ║ ║ ║ ImageView ╔══════════════╗ …
Nam Vu
  • 5,669
  • 7
  • 58
  • 90
49
votes
5 answers

How to get the Dimensions of a Drawable in an ImageView?

What is the best way to retrieve the dimensions of the Drawable in an ImageView? My ImageView has an Init-Method where I create the ImageView: private void init() { coverImg = new ImageView(context); …
Philipp Redeker
  • 3,848
  • 4
  • 26
  • 34
47
votes
10 answers

How to highlight ImageView when focused or clicked?

A good example of this is either on the Twitter launch screen (the screen with the large icons that is seen when the application is first launch) or even just look at the application tray when you focus an application icon. Basically I need to…
groomsy
  • 4,945
  • 6
  • 29
  • 33
47
votes
15 answers

Trying to get the display size of an image in an ImageView

I'm trying to get the real size of an image displayed in an image view. Actually my image is larger than the screen and the imageview is resizing the image to diplay it. I'm looking for this new size. I've tried to override the onDraw method of the…
Guillaume Ménant
  • 481
  • 1
  • 5
  • 3
47
votes
4 answers

Android set bitmap to Imageview

Hi i have a string in Base64 format. I want to convert it ot a bitmap and then display it to an ImageView. This is the code: ImageView user_image; Person person_object; @Override protected void onCreate(Bundle savedInstanceState) { …
kgnkbyl
  • 737
  • 1
  • 5
  • 16