imageview

take picture from camera and choose from gallery and display in Image view

这一生的挚爱 提交于 2019-11-26 23:18:12
问题 I want to take photos from gallery and set it in my ImageView as well as I want to take photo from camera and set it into my same Image View. I am very much stuck on this. Can anyone help me? Thanks. 回答1: You can handle your camera view click this way: cameraImageView.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent("android.media.action.IMAGE_CAPTURE"); startActivityForResult(intent, 0); } }); Do this in your activity when you

What is the difference between ImageView.setBackgroundResource and ImageView.setImageResource?

こ雲淡風輕ζ 提交于 2019-11-26 23:02:40
问题 I have seen these different approaches in setting images but I don't get the difference. Why there two methods? 回答1: setBackgroundResource is for setting the background of an ImageView. setImageResource is for setting the src image of the ImageView. Given: ImageView iv = new ImageView(this); Then: iv.setBackgroundResource(R.drawable.imagedata); Will fit the image for the entire background. That means it will stretch the image to fill that background entirely even if the image size is too

How do I resize an imageview image in javafx?

筅森魡賤 提交于 2019-11-26 23:00:25
问题 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? 回答1: Yes, using an ImageView. Just call ImageView imageView = new ImageView("..."); imageView.setFitHeight(100); imageView.setFitWidth(100); By default, it will not preserve the width:height ratio: you can make it do so with imageView.setPreserveRatio(true); Alternately you can resize the Image directly on loading:

IllegalArgumentException: width and height must be > 0 while loading Bitmap from View

一世执手 提交于 2019-11-26 22:48:46
I'm trying to draw on an ImageViewTouch, a library which enables pinch zooming. I'm able to draw over the image using Canvas, but when I zoom the image, the drawing disappears. For this, I'm trying to convert the view to a bitmap and set theImageBitmap for this same view. Here's the code: mImage.setDrawPath(true); mImage.setImageBitmap(loadBitmapFromView(mImage)); public static Bitmap loadBitmapFromView(View v) { Bitmap b = Bitmap.createBitmap( v.getWidth(), v.getHeight(), Bitmap.Config.ARGB_8888); Canvas c = new Canvas(b); v.layout(0, 0, v.getWidth(), v.getHeight()); v.draw(c); return b; }

Why are there extra pixels around my Android GridView?

别说谁变了你拦得住时间么 提交于 2019-11-26 22:36:30
问题 I have a GridView in my Android application that has a number of ImageViews in it. The space on my screen is limited and I want the images to take up as much of the available space as they can. Unfortunately, the GridView always leaves 5 pixels of empty screen space around the outside edge of the ImageViews (the space between ImageViews is set with horizontal/vertical spacing and behaves correctly). The empty space acts kind of like a margin around the ImageViews, but I can't get rid of it.

Make ImageView fit width of CardView

北慕城南 提交于 2019-11-26 22:35:21
问题 I have a CardView with rounded corners, I want to have an ImageView at the top like shown in the example taken from the material design guidelines below. <android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto" android:id="@+id/card_view" android:layout_width="wrap_content" android:layout_height="wrap_content" card_view:cardCornerRadius="4dp"> <!-- ... --> </android.support.v7.widget.CardView> Then inside the CardView I have this ImageView <ImageView

Bitmap in ImageView with rounded corners

白昼怎懂夜的黑 提交于 2019-11-26 22:35:08
问题 I have an ImageView and I want to make it with rounded corners . I use this: <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <solid android:color="@null"/> <stroke android:width="1dp" android:color="#ff000000"/> <corners android:radius="62px"/> </shape> And set this code as background of my imageview. It works, but the src image that I put on the ImageView is going out of the borders and doesn't adapt itself

how to set image from url for imageView

拈花ヽ惹草 提交于 2019-11-26 22:11:51
I wanna set Image in ImageView using Url for example I have this url http://www.google.iq/imgres?hl=en&biw=1366&bih=667&tbm=isch&tbnid=HjzjsaANDXVR9M:&imgrefurl=http://www.vectortemplates.com/raster-batman.php&docid=FxbVmggVf--0dM&imgurl=http://www.vectortemplates.com/raster/batman-logo-big.gif&w=2072&h=1225&ei=Zeo_UoSWIMaR0AXl_YHIBg&zoom=1 but there is no option to set url kalyan pvs EDIT: Create a class that extends AsyncTask public class ImageLoadTask extends AsyncTask<Void, Void, Bitmap> { private String url; private ImageView imageView; public ImageLoadTask(String url, ImageView imageView

What is the difference between src and background of ImageView

限于喜欢 提交于 2019-11-26 22:04:36
I am a little puzzled with using src or background for an ImageView . I know the former means the content of this ImageView and the latter means the background of the ImageView . But how to detect which one to use? I don't see the difference. All views can take a background image. The src to an ImageView has additional features: different scaling types adjustViewBounds for setting bounds to match image dimensions some transformations such as alpha-setting And more that you may find in the docs . If you set an image to be the background of your ImageView, then the image will scale to whatever

How To Display Border To Imageview?

别等时光非礼了梦想. 提交于 2019-11-26 21:47:36
Friends How To Display Border To Imageview ? I Want To Result Like Mobile gallery all image display with border. plz give me ans thanks for advance.... You can create a resource (layer drawable xml) for your ImageView 's "border" (actually background), and declare in your theme that the ImageView 's background resource is the drawable xml. If you need this "border" to be changed based on the ImageView 's state ( focused , selected , etc.), then you should create more layer drawables, and put them together into a selector xml (state drawable). Then in your theme you should set the ImageView 's