0

I have an state with district wise map image. I would like to put buttons on each district. if we tap on that we should redirect to the some other screen. what is the best way to design this screen.

thanks,

nurealam11
  • 537
  • 4
  • 16
naresh
  • 10,332
  • 25
  • 81
  • 124
  • how big is the map?? is it just one screen? – Rod_Algonquin Jun 04 '14 at 06:30
  • It's a India state map and it's in one screen. – naresh Jun 04 '14 at 06:35
  • This is probably going to be tricky if you are rolling the app out to multiple devices, but I would suggest looking at a `RelativeLayout` with absolute positioning as suggested [here](http://stackoverflow.com/a/3295056/716588). – CodeMonkey Jun 04 '14 at 06:48
  • With a bit of maths, you could also find out the width of the image on the device and then set the `LayoutParamaters` of the pins based on a scale. – CodeMonkey Jun 04 '14 at 06:49
  • @CodeMonkey: You mean, Set the map image as background of the Relative Layout and then add the button on absolute positions in Relative layout. am I right? – naresh Jun 04 '14 at 07:20
  • That's one way, the other way is to make a `RelativeLayout` as the root, then add your `ImageView` as one of the children with a width/height as `match_parent` and a `scaleType` of `centerInside` or similar. Then you would add the pins using your most appropriate scale based on the size of the image on the screen. – CodeMonkey Jun 04 '14 at 07:26
  • A more elegant solution if there was any possibility, would be to use the GoogleMaps API, show the mapview defaulted at your district then add the pins to the map if you know their Latitude and Longitude. I've done this before if you would like some help. You could get the Lat/Long of the pins you wish to use from Google Maps, then use those to show clickable pins. This is a fairly big undertaking though if you didn't want to use the Maps API... – CodeMonkey Jun 04 '14 at 07:31
  • But as you said, it may creates problems like UI alignment issues in multiple devices. I mean two buttons may reside in the same district. am i right? or it solves the problem. – naresh Jun 04 '14 at 07:34
  • That depends on the number of buttons, the type of buttons, how close they are etc. the difficulties (like dealing with overlapping buttons) are going to depend on those factors. I'd lean towards using Google Maps... – CodeMonkey Jun 04 '14 at 07:37
  • @CodeMonkey: If you don't mind. could you share that code with us. – naresh Jun 04 '14 at 07:38
  • I'll try and get something to you soon! – CodeMonkey Jun 04 '14 at 09:10

0 Answers0