android-imageview

Difference between a clickable ImageView and ImageButton

烂漫一生 提交于 2019-12-17 07:06:06
问题 I'm just wondering if there is any significant difference between an ImageView that's set to be clickable, compared with an ImageButton ? Is there any reason for using one over the other? Is there any restriction on the drawable for an ImageButton that leaves ImageView as the only possible option? Will I possibly lose any functionality of a button if I opt for a clickable ImageView over ImageButton ? 回答1: There's no differences, except default style. ImageButton has a non-null background by

Placing a textview on top of imageview in android

谁说胖子不能爱 提交于 2019-12-17 06:29:49
问题 I have a listview , that has a single imageview which is scrollable vertically I am trying to place a textview on top of Imageview Both the views must be visible Is it possible ? If yes, How to do it programmatically ? What changes should i need to make ? list_view_item_for_images.xml <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent" android:layout

Placing a textview on top of imageview in android

给你一囗甜甜゛ 提交于 2019-12-17 06:29:10
问题 I have a listview , that has a single imageview which is scrollable vertically I am trying to place a textview on top of Imageview Both the views must be visible Is it possible ? If yes, How to do it programmatically ? What changes should i need to make ? list_view_item_for_images.xml <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent" android:layout

How to save image in android gallery

为君一笑 提交于 2019-12-17 03:38:39
问题 I try to save the image into WathsappIMG but when I go to image gallery android I don't see the image and the image there into the directory can be seen from ES File Explorer OutputStream output; // Find the SD Card path File filepath = Environment.getExternalStorageDirectory(); // Create a new folder in SD Card File dir = new File(filepath.getAbsolutePath() + "/WhatSappIMG/"); dir.mkdirs(); // Retrieve the image from the res folder BitmapDrawable drawable = (BitmapDrawable) principal

How to save image in android gallery

给你一囗甜甜゛ 提交于 2019-12-17 03:38:20
问题 I try to save the image into WathsappIMG but when I go to image gallery android I don't see the image and the image there into the directory can be seen from ES File Explorer OutputStream output; // Find the SD Card path File filepath = Environment.getExternalStorageDirectory(); // Create a new folder in SD Card File dir = new File(filepath.getAbsolutePath() + "/WhatSappIMG/"); dir.mkdirs(); // Retrieve the image from the res folder BitmapDrawable drawable = (BitmapDrawable) principal

How to clear an ImageView in Android?

╄→尐↘猪︶ㄣ 提交于 2019-12-17 03:23:56
问题 I am reusing ImageView s for my displays, but at some point I don't have values to put it. So how to clear an ImageView in Android? I've tried: mPhotoView.invalidate(); mPhotoView.setImageBitmap(null); None of them have cleared the view, it still shows previous image. 回答1: I used to do it with the dennis.sheppard solution: viewToUse.setImageResource(0); it works but it is not documented so it isn't really clear if it effects something else in the view (you can check the ImageView code if you

How to stretch three images across the screen preserving aspect ratio?

十年热恋 提交于 2019-12-17 02:54:08
问题 I need to display three same size images (200 X 100) side by side (no gaps) on top of the screen. They should occupy entire width of the screen and preserve aspect ratio. Is it possible to accomplish that using only layout xml file, or I need to use java code? Solution shoud be resolution independant... Can anybody post a solution or link for this (or similar) problem? Thanks! 回答1: Got it working! But as I said above, you need to create your own class. But it is pretty small. I created it

High resolution Image - OutOfMemoryError

无人久伴 提交于 2019-12-17 02:37:38
问题 I am developing an application for the Galaxy S4. One of the requirements of the application is having a SplashScreen containing an Image of 1920x1080 pixels. Its a high quality .jpeg image and the size of the Image is about 2 Megabytes . The problem is that I am getting an OutOfMemoryError as soon as I start the Application. I am quite stunned that this already happens with an image of just 2 megabyte in size? How can I fix this problem and display the image? Changing the dimensions or the

Get the ID of a drawable in ImageView

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-17 01:58:07
问题 I have one ImageView and set a drawable on it. Now I need to get the ID of the drawable on click event of ImageView dynamically. How can I get it? imgtopcolor = (ImageView) findViewById(R.id.topcolor); imgtopcolor.setImageResource(R.drawable.dr); // How do I get this back? Now on touch event of imgtopcolor i want to need drawable id because I am setting different drawable each time and want to compare the drawable with other 回答1: I think if I understand correctly this is what you are doing.

“Bitmap too large to be uploaded into a texture”

廉价感情. 提交于 2019-12-17 01:34:19
问题 I'm loading a bitmap into an ImageView, and seeing this error. I gather this limit relates to a size limit for OpenGL hardware textures (2048x2048). The image I need to load is a pinch-zoom image of about 4,000 pixels high. I've tried turning off hardware acceleration in the manifest, but no joy. <application android:hardwareAccelerated="false" .... > Is it possible to load an image larger than 2048 pixels into an ImageView? 回答1: All rendering is based on OpenGL, so no you can't go over this