Can't Identify which element is used…?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-11 23:34:01

问题


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

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.


回答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.



来源:https://stackoverflow.com/questions/39011248/cant-identify-which-element-is-used

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!