Android Place image over image at certain position
I'm trying to build an app where I have an Image as ImageView which is my background. Now I want to place another Image at a certain position on top of the background. My target is that the user searches in a list of famous places. I already have that list. And i have a button "Map" for every list entry. When the users presses that button it jumps to the map activity.Currently it's just an activity with an imageview of my map. The image of the famous place should be placed at the right position on my background map.
But the problem now is that I want the background image to have several areas where the other image can be added. I don't really know how to define areas and maybe give them id's to place the second image at the right coordinates.
I was searching for days but didn't find any way how to do this. So I apologize in advance, as I'm new to android programming!
See the image for further explanation on what i want to achieve. So if a user searches the place test. And test is at the location x1 I want the image of the pin to be displayed at x1 on the map. And now my problem is on how to get the image coordinates of x1. Concept
You should use RelativeLayout and put any ImageView you like on this, It would be something like this:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_gravity="center_horizontal"> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/imageView" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:layout_marginTop="131dp" /> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/imageView2" android:layout_below="@+id/imageView" android:layout_alignParentLeft="true" android:layout_alignParentStart="true" /> </RelativeLayout> </LinearLayout>