imageview

Android - combine multiple images into one ImageView

强颜欢笑 提交于 2019-11-29 07:31:02
I'm looking for help developing (or a library) which can allow me to merge together multiple images into one imageview. My application is grouping together interactions between users, instead of displaying them singularly, and therefore I would like to merge all of their avatars, so that one adapter cell visualizes a "group". A fantastic example of this is done on facebook.com's chat as such: My question is, how can I provide this functionality in Android / Java? Presumably, it could a number of images between 1 and 4. Please let me know of any advice you can give :) Anton Bevza You can use

Android draw border in ImageView

雨燕双飞 提交于 2019-11-29 07:21:36
I want to draw a border around an image. But I can't align the border at the ImageView itself (like it is done mostly) because I translate and scale the image inside of the ImageView with the ImageMatrix (the ImageView itself is fill_parent / fills the whole screen). I had the idea to add a second image (which looks like a border) and translate & scale it in the same way as the image which should have a border, but it isn't very handy to do it this way. Has anybody a better idea to reach that goal? asenovm There are two ways to achieve this: 1) add padding to the imageView and set a background

How to set image in imageview in android?

荒凉一梦 提交于 2019-11-29 07:20:58
问题 I want to show an image in imageview so I made a folder - drawable in res and put my image there. Something like apple.png . Then I use this code: ImageView iv= (ImageView)findViewById(R.id.img_selected_image); String path = getApplication().getFilesDir().getAbsolutePath(); InputStream is = new FileInputStream(path + "/apple.png"); Drawable icon = new BitmapDrawable(is); Log.i("Fnord", "width="+icon.getIntrinsicWidth()+ " height="+icon.getIntrinsicHeight()); iv.setImageDrawable(icon); But

Getting the background color of an ImageView

落花浮王杯 提交于 2019-11-29 07:17:22
I have a plain ImageView object colorSquare . It is straightforward to set the color of the object by calling. colorSquare.setBackgroundColor(color); But how do I do the reverse, i.e. retrieve the color of the ImageView background? What u can do is get ColorDrawable from ImageView. ColorDrawable drawable = (ColorDrawable) colorSquare.getBackground(); now drawable.getColor() will give u the Color. This will work only if u have set the Color or else u will get ClassCastException private int colorfindcolor(View v, int x, int y) { int offset = 1; // 3x3 Matrix int pixelsNumber = 0; int xImage = 0;

How can I load Computer Directory images in JAVAFX

孤者浪人 提交于 2019-11-29 06:58:02
I am trying to load my computer folder images into a wall of thumbnails. I read on a thread from another forum that ImageView "url" instance variable does not support system paths. I tried with the solution there, but it throws an exception: java.lang.OutOfMemoryError: Java heap space as it keeps reading the file . another problem is it keeps giving me warning of using package javafx.ext -> SwingUtils.toFXImage method. I have also tried to input the URL like that: "file://localhost//Users/USER/Pictures/Camera/test/1.JPG" I tried to display a number of images, but it always only displays 3 to 4

How do I prevent scaling in Android Imageview?

倾然丶 夕夏残阳落幕 提交于 2019-11-29 06:49:10
问题 I have an image that is 480 pixels by 40 pixels. I would like to show this image in an ImageView without having it scale to fit. Ex: If my screen is only 320pixels wide I would like only 320pixels of the image to show on the screen, not have it cram itself into the ImageView (even if it means that the rest of the image gets cut off). Is there a way to prevent it from scaling to fit? EDIT: Also, I would like the left side of the image to line up with the left side of the device's screen.

Resize images with Glide in a ImageView Android

百般思念 提交于 2019-11-29 06:46:48
I have a lot of doubts about the treatment of the images in android, and I was hoping to see if you could solve them. At this point I have an image that occupies 320 dp high, and match_parent width, which is around 60% of the screen. This image of the load with Glide, of some images in 1080 that I have personally. I tried to make centroCrop and fitXY, but always deform the images. The first type I know cuts the image, but the second one fits a size, but it does deform the image high or wide. Is there any way, to insert it with Glide and see it as it is? What properties have I to touch on

Repeat drawable in imageview?

爷,独闯天下 提交于 2019-11-29 05:44:09
Is it possible to repeat a drawable in an ImageView? I manage to repeat my drawable as a divider in a ListView, but not as an ImageView. Here is my repeated image definition: <bitmap xmlns:android="http://schemas.android.com/apk/res/android" android:src="@drawable/xdividerrepeat" android:tileMode="repeat"/> Thanks Markus Matthew Willis You could use a "dummy" view like a LinearLayout to accomplish this. Just create a LinearLayout with the size you need and set its background drawable to be your repeating bitmap. See Android Tile Bitmap . Yes it's possible. You just need to specify the scale

Deep copy of a Drawable

可紊 提交于 2019-11-29 05:35:07
I have an ImageView. In its onClick I get its Drawable: Drawable dr = ((ImageView) v).getDrawable(); And set it to a dialog's ImageView: zoomedImage.setImageDrawable(dr); But when I close the dialog or the activity is resumed. The image at the original position gets stretched and is shown larger than its size, leading to only a portion of the image is visible in the ImageView. Is this a case of deep copy or there is another problem? If it is, how can do I deep copy the original Drawable so that I could set the copy to zoomed image? Thanks in advance. Finally I succeed! I had similar problem,

Android: How to prevent image from being scaled in ImageView or ImageButton?

人盡茶涼 提交于 2019-11-29 04:15:25
问题 How can I prevent my bitmap from being scaled automatically in an ImageView or ImageButton if the view or button is stretched using "fill_parent" or using "weight"? This will be useful, for example, to create a 4-button toolbar at the top of the screen where the buttons are equally spaced, but the images inside the buttons keep getting streched even if I use scaleType="center", which should prevent scaling according to the doc, but it doesn't. Any insight is appreciated! Thanks, 回答1: I have