In my application, i need to display a map of France, divided into 5 zones.
I did it with an image editor : i divided my map into 5 parts and save each part as a png. Each PNG has the same size.
Now, I add 5 ImageView (with the same size) in a RelativeLayout and i obtain this :
France Map 5 Parts
The goal is now to make clickable zones as described on the map. I don't know how to do this (which layout ? how to put them in my layout ?...)
Maybe RelativeLayout? You can place four background images in a regular way (using toLeftOf, toRightOf, below, ...) and one foreground image with alignParentTop and centerHorizontal set to true with proper layout_margins{Top, Left/Right}.
Also remember that android draws xml layouts from top to bottom, so your foreground image should be the last in layout file.
Related
I intend to create an application that shows images that are in a vertical line (later the line can become a curve) but they can overlap.
It means that images at the bottom of the list can be partially over the next image in line but their "distance" can be modified dynamically so the overlap can be gone if the distance is big enough.
I was thinking of what solution I should use.
I could use a ListActivity and create the row item layout for the images and set is orientation to vertical - it seems hard to customize
I could use some canvas drawing but then I have to calculate distances of centers of the images to create a line (curve) - it seems lots of extra work to make the layout okay
What else should I consider?
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
I am creating a xml layout for android in which I have a imageview which shows an image of a human body. On top of this imageview I have placed buttons for arms, legs etc. However my problem is the buttons are misplaced when launching the app on a phone with a larger screen. Is there any solution for creating a layout with buttons on top of the image which works on different screens?
Regards
SOLVED:
I solved the issues by adding my image to a layout for which I assigned a specific range of x y dp instead for aligning the layout with top/bottom which resulting in the layout to stretch when using a larger screen. Then the buttons which I added to the layout would not "change" position and stay correct acoording to the image.
Did you follow the instructions in the developer guide?
http://developer.android.com/guide/practices/screens_support.html
You can also find an example application:
http://developer.android.com/resources/samples/MultiResolution/index.html
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.
I have created a button in Photoshop and I have split them into 3 images. Now I want to put those images into android button. I know how to create layouts in android but the point I am missing is how can I make them fluid?
So there is a button for which I have 3 images.
I now want to ask how can I use these images for a <Button> tag so it expands repeating the middle one. Do I need to create style here and then put background="#drawable/three_button_style" or there is something I really need to know?
Is the same going to be true for ListView? I got a list view and images for top, middle and bottom so can I create a ListView of 3 images repeating the middle one?
For scaling items Android usually uses 9-patch, which behaves something like your example but also vertically. Here's a link to the 9-patch tool that can be used to draw these:
http://developer.android.com/guide/developing/tools/draw9patch.html