gpt4 book ai didi

android - 在 map fragment 上叠加自动完成 fragment

转载 作者:太空宇宙 更新时间:2023-11-03 13:17:00 25 4
gpt4 key购买 nike

我正在尝试将自动完成 fragment 覆盖在 map fragment 上。问题是我的自动完成是透明的,它没有得到我设置的白色背景。对此有什么建议吗?

<FrameLayout 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"
tools:context=".MainActivity">

<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=".MapsActivity"
android:layout_gravity="center_horizontal|bottom" />

<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:orientation="horizontal" >

<fragment
android:id="@+id/place_autocomplete_fragment"
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_marginTop="20dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:background="#FFFFFF"
android:name="com.google.android.gms.location.places.ui.PlaceAutocompleteFragment" />
</FrameLayout>
</FrameLayout>

最佳答案

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
map:uiZoomControls="true"
map:uiZoomGestures="true"
map:mapType="normal"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MapsActivity">
<fragment
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.greenfeetsurvival.greenfeetaviator.MapsActivity">
<android.support.v7.widget.CardView
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="@+id/card_view"
android:layout_gravity="top"
android:layout_margin="5dp"
android:layout_width="200dp"
android:layout_height="40dp"
card_view:cardCornerRadius="4dp">
<fragment
android:id="@+id/place_autocomplete_fragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:name="com.google.android.gms.location.places.ui.PlaceAutocompleteFragment" />
</android.support.v7.widget.CardView>
</fragment>
</LinearLayout>

这是我在我的应用中使用的布局。 PlaceAutocompleteFragment 看起来与 Google 工具完全一样。它位于 map 顶部的左上角,边距为 5dp。

关于android - 在 map fragment 上叠加自动完成 fragment ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34496504/

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