0

I've an android application, which set Location based reminders. After I added an alarm, it displays as following.

enter image description here

I can't understand which component is used to display the small map and text both. Also the small map has location which I've selected on the map. I'm developing similar application, and I want to use this type of display feature.

Community
  • 1
  • 1

1 Answers1

-1

That looks like a Lite mode Google Map to me.

this video is the best explanation on the internet and covers the use case i think you are refering to. https://youtu.be/N0N1Xkc_1pU

You can check out my answer to another similar question here: https://stackoverflow.com/a/39462819/3456841

Here's the google developers page on the topic https://developers.google.com/maps/documentation/android-api/lite

Also here's a link to a demo activity that uses lite maps in a list https://github.com/googlemaps/android-samples/blob/master/ApiDemos/app/src/main/java/com/example/mapdemo/LiteListDemoActivity.java

you probably want your list item layout file to look something like

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:layout_toLeftOf="@+id/map">
    <TextView
        android:id="@+id/title"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />
    <TextView
        android:id="@+id/location"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />
    <TextView
        android:id="@+id/created_at"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />
</LinearLayout>

<fragment
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:map="http://schemas.android.com/apk/res-auto"
    android:name="com.google.android.gms.maps.MapFragment"
    android:id="@+id/map"
    android:layout_width="80dp"
    android:layout_height="80dp"
    android:layout_alignParentRight="true"
    map:cameraZoom="13"
    map:mapType="normal"
    map:liteMode="true"/>

</RelativeLayout>

Note the map:liteMode="true" in the map fragment declaration.

Community
  • 1
  • 1
Ethan
  • 179
  • 1
  • 9