this is my first post here, so please forgive me for the possible trivialness of the problem.
So I'm trying to create my first android app which is basically a navigation system of a closed area. I want to mark a route from point A to B on a picture of a map using red dots.
As a non-experienced android programmer i came up with a solution:
GridLayout on an ImageView - a grid would be filled with dots that are not visible and the chosen ones would be set to visible (I got the choosing part sorted out).
The point is I don't know a way of positioning them directly one on another. As of right now the dots are appearing from the top of the screen while the map is centered.
Coping with different screen sizes is another matter that will probably require some further try and fail method once the alignment thing is sorted out.
Thanks for any feedback!
Okay, so I managed to solve my little problem:
I had to add
android:adjustViewBounds="true" to the ImageView.
This way the boundaries of the image are on it, not on the layout. Then I could align the GridLayout -
<ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/map" android:id="@+id/map" android:adjustViewBounds="true" android:layout_centerInParent="true"/> <GridLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignTop="@id/map" android:id="@+id/gridlayout"> <ImageView android:layout_width="16dp" android:layout_height="16dp" android:src="@drawable/dot" /> </GridLayout>
Also I'm using RelativeLayout to do so