I would like to display an icon in mapview just like the "change to list view icon" displayed on Google Places program. any clue how to do that?
If you need to put an icon in a relative place of the screen you can merge the mapview with a relative layout (in the XML page) some thing like this:
<merge
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<com.google.android.maps.MapView
android:id="#+id/mapView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:apiKey="xxxxxxxxxx" />
<RelativeLayout
android:id="#+id/rl"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/icon">
</ImageButton>
</RelativeLayout>
</merge>
Or if you need to use an icon over a map coordinate that you specify then you need to define an overlay.
hope this helps :)
What you want is called an Overlay. Check out the Google Map View tutorial under Part 2.
Related
I am working on a project where i need to have a map to be shown inside a circle.How can i show a mapview inside a circle.
You can compose the layout with a FrameLayout. The first item must be the MapView and then an ImageView referencing a png with that circle transparent. Hope that helps.
Edited to add an example:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<com.google.android.maps.MapView
android:id="#+id/mapview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:clickable="true"
android:apiKey="whateverYourApiKeyIs"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/fullSizeImageWithTransparentCircle"/>
</FrameLayout>
Since you write such a bad question. Allow me to answer in the same style.
Take a mapview.
Style it with round corners
I'll even give you a link to round corners
Im stuck in getting this to work.
Look at the picture below, i want the bubble to be placed under the image.
And of course would like to be able to place the view wherever i like.
I think the problem is in the parent view so i add parent xml to .
Maybe i need to change RelativeLayout to something else,
I have tried many things but nothing works
.
Here is my xml for the bubble
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout android:id="#+id/frameLayout_balloon_gallery_activity_send"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
<ImageView android:id="#+id/imv_balloon_gallery_activity_send"
android:src="#drawable/balloon_gallery"
android:scaleType="fitCenter"
android:layout_height="fill_parent"
android:layout_width="fill_parent"/>
</FrameLayout >
here is the parent that i insert the bubble into
.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout android:id="#+id/relativelayout_main_activity_back"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical">
<Gallery xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/gallery_activity_back"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:spacing="2dip"
android:gravity="top"
android:paddingTop="20dip"
/>
<RelativeLayout
android:id="#+id/relativeLayoutinner_activity_back"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" >
<EditText
android:id="#+id/etx_addtext_activity_back"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:singleLine="false"
android:text="#string/string_enter_text_here"
/>
</RelativeLayout>
</RelativeLayout>
You will want to create a RelativeLayout that contains both the ImageView and the bubble inside it. Position the bubble below the ImageView using the position below attribute. From there you can move the RelativeLayout around wherever and the bubble will remain under the image.
Check out how the Quick Actions were implemented here http://www.londatiga.net/it/how-to-create-quickaction-dialog-in-android/. The functionality is similar to what you want.
As you can see from the question I need to put some button on mapView, where the app will by presing the button by user, refresh the mapView with current location.
I know how to put the button above, under, but how to put on map???
If anyone has some sample code, or some guidance help is appreciated...
You'll want to use a RelativeLayout and lay the button over top of the MapView. Just make sure not to place it over the Google logo. Here's a sample XML:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.maps.MapView android:id="#+id/google_maps"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:apiKey="#string/maps_key"/>
<Button android:id="#+id/googlemaps_select_location"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:text="Select"/>
</RelativeLayout>
Hi man search for overlay item is what you need :D here google link
http://developer.android.com/resources/tutorials/views/hello-mapview.html
and good sample :D
https://github.com/jgilfelt/android-mapviewballoons
i want to add a view in my application which has to be clickable, i've tried a dialog but it block the execution of the game, i've also tried to add a view to the WindowManager but it's not clickable. How can i create a "banner like" view?
In my understanding, you want to have a banner view floating above your game view. Try using FrameLayout. Following is a sample xml, hope it can help:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent">
<!-- Replace this with your banner -->
<ImageView android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="#drawable/icon"/>
<TextView android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="Replace this with your game view"/>
</FrameLayout>
In my application i have mapview and I want to show distance in a textview and also a Button ,
I have done this.and tried this..
http://www.anddev.org/post3452.html#p3452
PROBLEM IS>>>>
I WANT TO SHOW TEXTVIEW AND BUTTON OVER THE MAP VIEW..
so I can See MAPVIEW in Full Screen..with other items over it(as we can see map through textview)..
Any SPECIFICATION NEEDED TO BE DONE IN xml FILE..??
Please..Reply me..
Thank You..in advance
Yes you can do that.
For eg:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent">
<com.google.android.maps.MapView
android:id="#+id/mapView" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:enabled="true"
android:layout_centerInParent="true" android:clickable="true"
android:apiKey="your api key" />
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="Click"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true" android:id="#+id/clickBtn" />
</RelativeLayout>
create a layout with the RelativeLayout and embed the map view in it. Once set, set the relative position of your components as per your need.