Implement different clickable Area on an image-page through image map
-
A B C D E F G H --figure. I am working on Book App on Android. In my book App, there are many images-pages. In first image-page there are 26 alphabets(A-Z),4 alphabets in a raw(as shown in my picture). My Problem is: I want to developed a click-able area for each and every alphabets (A-Z) . when user click or touch on any of alphabet then a square box should be appear like "image A is clicked"(shown in above figure). On every touch or click on alphabets images(A-Z) i will pass corresponding sound. Means i want to call different-different Listeners for different-different area on a single image-page. i have no idea about how to implement click-able area on an image which click able area or coordinates doesn't vary emulator to emulator. please provide me some sample code or an idea or reference link. Thank in Advance
-
Answer:
I remember answering a very similar question just a few days ago. In order to implement this as the image, you'll need to know what areas of the image mean what (i.e. if you get coordinates of of a touch event, which action these coordinates would correspond to). Provided you have this info, you can then register OnTouchListener with your ImageView: imageView.setOnTouchListener(new OnTouchListener() { public boolean onTouch (View v, MotionEvent event) { int x = event.getX(); int y = event.getY(); //now deal with coordinates (x, y) } }); However in your case, I would suggest using a layout with 26 buttons and just use OnClickListener with each of them. You can easily set the buttons up in the shape you want and you can easily set individual background drawables to them to make it look as one whole image.
user1355962 at Stack Overflow Visit the source
Related Q & A:
- How to drag image over different layout?Best solution by Stack Overflow
- How to change thin image to fat image in iPhone SDK?Best solution by Stack Overflow
- How to place a different background image on each part of a book?Best solution by TeX - LaTeX
- How to make an image have a different color?Best solution by superuser.com
- What is an upright image and real image?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.