imageview

How to show image using ImageView in Android

拥有回忆 提交于 2019-11-27 00:54:21
问题 I am looking for the way to assign image src to image view control. I read few example and they says something src="@drawable\image" but didn't understand this, also I want to assign image src at runtime by java code also want to apply default image in XML. 回答1: If you want to display an image file on the phone, you can do this: private ImageView mImageView; mImageView = (ImageView) findViewById(R.id.imageViewId); mImageView.setImageBitmap(BitmapFactory.decodeFile("pathToImageFile")); If you

Change Image of ImageView programmatically in Android

给你一囗甜甜゛ 提交于 2019-11-27 00:45:37
When I change the image programmatically‎, it shows new image on top of the old image which is set originally in layout file? Here is a snippet of my layout file: <LinearLayout android:layout_width="match_parent" android:layout_height="39dp" android:gravity="center_vertical" > <ImageView android:id="@+id/qStatusImage" android:layout_width="16dp" android:layout_height="16dp" android:layout_margin="5dp" android:background="@drawable/thumbs_down" /> <TextView android:id="@+id/grp_child" android:layout_width="fill_parent" android:layout_height="fill_parent" android:textColor="@color/radio_colors"

android:select image from gallery then crop that and show in an imageview

醉酒当歌 提交于 2019-11-27 00:31:49
i really need this code and i searched for 3 hours on internet but i couldn't find a complete and simple code and i tested many codes but some didn't work and others wasn't good,please help me with a full and simple code,thank you edit:i have this code for select image but please give me a full code for all things that i said in title because i cant resemble codes. btn_choose.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub Intent intent = new Intent(); intent.setType("image/*"); intent.setAction(Intent.ACTION_GET_CONTENT);

Displaying YUV Image in Android

我怕爱的太早我们不能终老 提交于 2019-11-27 00:31:34
In my application, we need to display the Video frame receives from server to our android application, Server is sending video data @ 50 frame per second, having encoded in WebM i.e. using libvpx to encode and decode the images, Now after decoding from libvpx its getting YUV data, that we can displayed over the image layout, the current implementation is something like this, In JNI / Native C++ code, we are converting YUV data to RGB Data In Android framework, calling public Bitmap createImgae(byte[] bits, int width, int height, int scan) { Bitmap bitmap=null; System.out.println("video:

Android: how to convert whole ImageView to Bitmap?

这一生的挚爱 提交于 2019-11-26 23:53:02
I have my application that is displaying images with different ratio, resized inside (centerInside) imageView. What I need is to create bitmap from the ImageView including the background (black in this case). So for example I have device screen 320x480, full screen imageView with image resized to 280x480. How could I get 320x480 bitmap from it? On top of this imageview I have some logos or buttons that I don't want to include to bitmap, they're like on top layer. All I need is bitmap with image and black border from some sides. Have you tried: BitmapDrawable drawable = (BitmapDrawable)

Mask ImageView with round corner background

谁都会走 提交于 2019-11-26 23:51:13
I am having a Custom ListView which contains an ImageView and TextView . Everything is working fine. What I want is the image is displayed in list are in round corner. From the Webservice i get the images in rectangle shape. But i want to display it in Round corner ImageView as below. Can anyone show me the way how can i mask the image in round corner? I already tried by creating the drawable file as below and applied it as src in ImageView . But nothing working for me. <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item> <shape android:shape="oval" > <solid android

How to load images from URL in JavaFx if recieving HTTP Error 403 [duplicate]

岁酱吖の 提交于 2019-11-26 23:41:22
问题 This question already has answers here : 403 Forbidden with Java but not web browser? (4 answers) Closed last year . I was trying to help someone out with what I thought was a duplicate and a simple question, but it turned out to be slightly more complicated and I couldn't give a definite answer. Here is the original question. I tried the code with different images on sites using the https protocol and none worked. I then took some images and added them to sites that use http protocol and

Android: How to get Drawable Image name

家住魔仙堡 提交于 2019-11-26 23:37:45
问题 I want to get the name of the drawable image and want to store that name in a string. For example , for an Image, I might use a .png file named play.png or stop.png. I just want to know which image in drawable is used for the ImageView.. Is there any way to get the name of the drawable/(??.png) Thanks. 回答1: I donot think there is any direct way to get name of drawable image unless you stores the image name along with image. In XML you can do the following to set image name as an additional

How can I give an imageview click effect like a button on Android?

半腔热情 提交于 2019-11-26 23:24:59
I have imageview in my Android app that I am using like a button with the onClick event given, but as you might guess it is not giving imageview a clickable effect when clicked. How can I achieve that? You can design different images for clicked/not clicked states and set them in the onTouchListener as follows final ImageView v = (ImageView) findViewById(R.id.button0); v.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View arg0, MotionEvent arg1) { switch (arg1.getAction()) { case MotionEvent.ACTION_DOWN: { v.setImageBitmap(res.getDrawable(R.drawable.img_down));

Android, ImageView over ImageView

谁说我不能喝 提交于 2019-11-26 23:23:19
问题 I have a quite simple question to ask: I need to put a small logo over an ImageView, large all the screen, in the bottom right area of the screen, but I don't know how to set the coordinates or how to say the ImageViews to be in a relative position. Something like this: 回答1: Try this <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" > <ImageView android:id="@+id/imageView1" android:layout_width=