gpt4 book ai didi

java - 如何在谷歌地图上添加矩形框?

转载 作者:太空宇宙 更新时间:2023-11-04 10:52:47 24 4
gpt4 key购买 nike

我想在 Google Map 顶部添加 3 个框将一些文本从底部开始堆叠在一起。

注:<Button>我用它来测试谷歌地图上是否会出现任何内容。结果什么也没出现。

我是否走在实现我想要的目标的正确轨道上?我应该改变什么?

enter image description here

这是activity_maps.xml :

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">

<EditText
android:id="@+id/searchBar"
android:layout_width="289dp"
android:layout_height="wrap_content" />

<Button
android:id="@+id/searchButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:onClick="onSearch"
android:text="SEARCH" />

</LinearLayout>

<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.mancj.example.MapsActivity">
</fragment>

<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="10dp"
android:layout_marginBottom="20dp"
/>

</LinearLayout>

最佳答案

好吧,试试这个

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">

<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.mancj.example.MapsActivity">
</fragment>

<LinearLayout
android:background="@android:color/white"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true">

<EditText
android:hint="Search"
android:id="@+id/searchBar"
android:layout_width="289dp"
android:layout_height="wrap_content" />

<Button
android:id="@+id/searchButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:onClick="onSearch"
android:text="SEARCH" />

</LinearLayout>

<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:id="@+id/button2"/>

</RelativeLayout>

关于java - 如何在谷歌地图上添加矩形框?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47624790/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com