I want to implement a application in this application multiple click event like periodic table i want to use large image for this and make image clickable from its different different part called element in this implementation zoom and scroll feature are also include
Try this:
Define a Rect for the spot/area that you would like to make clickable. Also remember to redifine it based on screen layout size and resolution.
Now onTouch event get the x and y position and calculate whether it lies within the defined Rect and act accordingly. The Rects will act as virtual image maps.
I think you have to divide your large image into sub images and add these sub images to every image view. You have to create a layout such that all these image views must show the original large image without any disturbance at corners, then only you can get separate click events for each sub image.
I think that this is a good idea.
Use a "layer" with different alpha level areas. Each area with a specific alpha level is a specific action-click.
https://groups.google.com/d/msg/android-developers/_6u3Iu-sYrI/DA0KCo8pTksJ
Related
I want create images for each state.. (texas,montana,california.....)
Example image USA map :
I tried put images over and over for each states like below (50 states, 50 images)..
For example Texas image :
It was bad way.. Can i achieve this another way? or different opinion?
Use free crop in PicsArt. Go to edit and select the picture. Select tools and then free crop. Colour in the bit you want to keep and save it. I hope this helps!
I'd suggest you using 2 ImageViews - one on the top of another. On the bottom ImageView you can draw image of whole map without the State names.
On the top ImageView you can draw the names only.
Then you set onTouchListener to the ImageView, and on touch you just get the color of touched pixel. After that you match touched color with the state colors, and this way you know, which state was clicked.
For this every state has to have it's own color.
i am trying to create the following UI in android app
In the above image all the five are to be image buttons. How to design this UI as like in the screen shot please help me friends....
Inside LinearLayout take RelativeLayout and make it centrally aligned.Then
Take first image Near me and set it's property.
Now take the second image Explore and set it to right of first image.
Place third image My network and place it below first image.
Fourth image Live set this to right of third image and and below second image.
Now center aligned your center image.
You will need to create 5 images, each of which has transparent areas. This layout type lets you position elements relative to the layout group itself, as well as to items within the group.
I'm not very familiar with Android advanced layout design, but the common layout objects give an idea:
There is a SurfaceView which gives you the ability to manipulate z-coördinates. In the SurfaceView you can then place a Grid/Relative/TableLayout for the 4 buttons (which you pre-render as rectangular images with transparency) and a simple Layout which centers and only contains the middle button.
If you then set the Z value of the first layout to less than that of the second you will get the view you want.
What are some ideas about having an ImageView that takes up the whole screen and making only parts of it clickable? I was thinking that I could extend the ImageView class and override its ontouch method which would allow me to detect touches based on an x and y. The only problem I can see with this is on different resolutions the touches might not map to the correct areas. I suppose I could then detect the resolution and figure out some way to map the x and y to the correct areas. I feel like there must be an easier way though. Does anyone have any other ideas?
How about creating transparent views with your desired click listeners on top of the ImageView using a RelativeLayout. You can use the xml to place those "hotspots" where you would like them relative to your image and define the layout so the "hotspot" view scale properly along with the image when displayed on different resolutions.
If the 'hotspot' shapes are not too complex, you could dynamically split the image, setup individual clicklisteners and re-merge the drawables in a way for them to appear contiguous. I do like Gregg's method more though.
I want to apply drag,zoom in/out,rotate using multitouch to two images .one
image is placed on the top of the other. after applying these action
Create a image
from above two images after
changes made by applying actions.
I succeed in apply zoom/drag to top image ,created new image from that.
main problem is
1.How to apply action to two images, one image at a time ?
2.How to switch to another image from currently showing image
(which layout I should use)?
3.How user can have a facility to rotate or zoom a image using multitouch ?
What I am missing, Sorry for the list -:)
You need to keep the transformation done to Bitmap1 and apply it again to Bitmap2. for example you can use a Matrix calculated using touch events in order to apply it to the two Bitmaps.
I am not sure to uderstand what you want to do. What i understand is: you've got multiple imageview (that can be composed of 2 images placed on top of another) floating on the layout and you want to select one of them to resize / rotate it.
In order to do that you can simply use the ontouch event of an imageView.
Rotate + zoom with multitouch is not easy in Android, lots of code have to be written in order to make it work nicely. I suggest you to use an existing library. I used this one and it worked like a charm:
https://github.com/lukehutch/android-multitouch-controller
You can see in the sample provided http://code.google.com/p/android-multitouch-controller/source/browse/trunk/demo/MTPhotoSortr/src/org/metalev/multitouch/photosortr/PhotoSortrView.java that you can retreive at any time the new center, angle, and scale ratio of the updated images in mImages(i).getCenterX(), mImages(i).getAngle(), mImages(i).getScaleX(), ...
Using this values you can replicate the transformations (rotation, scaling, translation) on another Bitmap.
I have some images that I want to put on top of each other on random order.
If it possible using one ImageView or do I need to create multiple image views based on number of images?
You don't completely specify what you want.... if you want the images to be placed in different positions (in the X and Y axis), meaning that while watching the photo on the top you can see part of the other images, then you have to create different ImageViews, or drawing them on a canvas (I think this one is much better).
If the images are just one on top of the other (hiding the one on the bottom), you just have to use one ImageView.
LayerDrawable may fit your requirement, you may refer to this post overlay two images in android to set an imageview