【问题标题】:Can't Identify which element is used....?无法确定使用了哪个元素....?
【发布时间】:2016-12-24 23:22:53
【问题描述】:

我有一个 android 应用程序,它设置基于位置的提醒。添加闹钟后,显示如下。

我不明白哪个组件用于显示小地图和文本。小地图也有我在地图上选择的位置。我正在开发类似的应用程序,我想使用这种类型的显示功能。

【问题讨论】:

  • 你有那个应用程序的源代码吗?
  • 答案当然是NO。
  • 小地图是保存在RelativeLayout或其他布局下的MapView!!!
  • 但它是可点击的。那么文字呢?
  • 在开发者选项中...勾选“显示布局边界”

标签: android android-maps


【解决方案1】:

在我看来,这就像一个精简模式的 Google 地图。

此视频是互联网上最好的解释,涵盖了我认为您所指的用例。 https://youtu.be/N0N1Xkc_1pU

你可以在这里查看我对另一个类似问题的回答:https://stackoverflow.com/a/39462819/3456841

这是关于该主题的谷歌开发者页面 https://developers.google.com/maps/documentation/android-api/lite

这里还有一个演示活动的链接,该活动在列表中使用了精简地图 https://github.com/googlemaps/android-samples/blob/master/ApiDemos/app/src/main/java/com/example/mapdemo/LiteListDemoActivity.java

您可能希望您的列表项布局文件看起来像

<?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>

注意地图片段声明中的 map:liteMode="true"。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-08-23
    • 1970-01-01
    • 2014-10-22
    • 1970-01-01
    • 2010-10-07
    • 2019-11-17
    • 2016-05-03
    • 2015-05-05
    相关资源
    最近更新 更多