gpt4 book ai didi

android - 在 Google map fragment android 上显示透明布局

转载 作者:行者123 更新时间:2023-11-29 14:49:37 25 4
gpt4 key购买 nike

我想在 map fragment 上显示透明布局,其中包括一张图像和一行文本作为 map 上的提示。当用户单击该布局时,它将变得不可见,并且将显示 map 。不知道在 map 上显示透明的。请帮忙。

我的 map 布局是:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/map_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:padding="@dimen/ten_dp" >

<fragment
android:id="@+id/map_address"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.SupportMapFragment" />

最佳答案

你只需要将透明颜色设置为背景值

background:"@android:color/transparent"

在你的情况下,只需添加一个布局

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/map_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:padding="@dimen/ten_dp" >

<fragment
android:id="@+id/map_address"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.SupportMapFragment" />

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/transparent">
<TextView/>
<ImageView/>

</RelativeLayout>

</RelativeLayout>

关于android - 在 Google map fragment android 上显示透明布局,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22786205/

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