I'm New in Android World
I have an activity which preview images by imageview and the image view take a fill parent and fill all the screen, I want when i click the image view show for example a seekbar on the top of the image without reducing the image size .
note the seek bar already invisible and i show it correctly
but i want it show on the image view itself without reduce the image height.
thanks
Related
Is there a way to define a clickable area in an image? Something equivalent or similar to map-area tags in HTML? Or is there a standard way of doing this sort of thing?
A possible method
1) get the width, and height of the image view using (in pixels)
2) get the coordinates of the image view (which is the top left corner of the image view)
3) create a touch listener, and record the coordinates of the users touch
4) if the user's touch coordinates fall on the image do whatever you want to
If you only want to do certain things based on where the user touches you will have to calculate the coordinates of those regions using the coordinates of the image view, and the image views width and height.
I think there might be no standard way for this, but you can achieve it by placing a transparent VIEW over your imageview. Set click listener to that view and make imageview clickable false.
When i have to do something similar, i use an include view.
As for the layout the include view will be accessing, i would use FrameLayout as root.
Its children would be the ImageView that i want to depict, along with a LinearLayout infront of it containing Buttons at the positions i want the user to choose from.
Then in code, i set listeners to these buttons.
Lastly, i would set the buttons so that there background is transparent and text is not available.
For example in a project i am working on, i have an ImageView with an Image of Ocean as background.
In front of the view i have a LinearLayout with smaller ImageViews with images of islands.
I place listener on the islands to see when they are clicked to open a new activity.
I'm trying to take a screenshot with Robot and view it in an ImageView, The problem is the screenshot coordinates is the ImageView Global coordinates.
So basically I'm trying to capture what's behind the Imageview but instead I get a picture of the Imageview itself.
I can't minimize because I'm taking several continuous screenshots that may vary in resolution.
What can I do?
I'm new to Android Java programming. For a project I need transparent images, which change dynamically. I have created a layout with an ImageView. And in it a small GIF USA flag GIF with a transparent background.
In code I connect the variable to the imageview and assign the same image to the variable from the ImageResources
ImageView image = (ImageView)convertView.findViewById(R.id.listview_image);
image.setImageResource(R.drawable.vlag);
This goes pretty well however the image is displayed with a white background. The transparency is lost. This is shown in the image below by the white background.
GIF over ImageView are always an issue. Use GIFImageView
And you must use it this way:
gifImageView = (GifImageView) findViewById(R.id.gifImageView);
gifImageView.setBytes(bytes);
gifImageView.startAnimation();
Even it has an option to download the gif from the web.
I have an imageview that displays a photo taken with the phone's camera, which can be changed by the user. The problem I'm having is that the picture is scaling too small within the imageview, is there a way to force the bitmap to fit the imageview completely?
Next time, please search a few minutes, before you ask a question!
In the layout xml-file you have to add the following attributes to your ImageView to make it fill out the view:
android:scaleType="fitCenter"
You can find the attribute in the ImageView documentation's list of XML Attributes. The different scaleTypes can then be found by clicking "android:scaleType" to get to its description.
I'm creating an Android application which adds frames to images (Think those things at the beach that you stick your head in...), but I want the image to show on top of the surface view holding the camera feed so that the user can position the subject of the photo.
The problem I'm having is that the camera feed (the surface view) is showing either side of the image. I want to re-size the surface view to fit the image. The size of the image may vary.
I think you like to have some overlay on top of surface view - this is achieved with frame layout like this:
http://javaocr.svn.sourceforge.net/viewvc/javaocr/trunk/demos/sampler/res/layout/main.xml?revision=229&view=markup
You can place everything but other surface view in the overlay