Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/401.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 谷歌地图android上显示按钮的问题_Java_Android_Xml_Maps - Fatal编程技术网

Java 谷歌地图android上显示按钮的问题

Java 谷歌地图android上显示按钮的问题,java,android,xml,maps,Java,Android,Xml,Maps,我在安卓系统中使用谷歌地图。试图用谷歌地图和其他一些小部件在屏幕上创建一个布局,比如抽屉图标。这是我的xml代码。 我面临的问题是,抽屉图标在xml设计布局中是可见的,但当我在设备上运行应用程序时,它是不可见的 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xm

我在安卓系统中使用谷歌地图。试图用谷歌地图和其他一些小部件在屏幕上创建一个布局,比如抽屉图标。这是我的xml代码。 我面临的问题是,抽屉图标在xml设计布局中是可见的,但当我在设备上运行应用程序时,它是不可见的

<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"
    tools:context=".ui.home.HomeFragment">


       <com.google.android.gms.maps.MapView
        android:id="@+id/mapView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        tools:ignore="MissingConstraints" >
           <ImageView
               android:layout_width="wrap_content"
               android:layout_height="wrap_content"
               android:src="@drawable/ic_menu_orange"
               android:layout_marginTop="20dp"
               android:layout_marginLeft="20dp">
           </ImageView>
       </com.google.android.gms.maps.MapView>
</RelativeLayout>

我使用过地图,但没有使用谷歌地图,不管怎样,您是否尝试过将imageview放在相对布局中,而不是放在地图视图中?RelativeLayouts就是为了这个目的而创建的,因此init中的项可以重叠。不确定google maps mapview是否会访问Imageview

<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"
tools:context=".ui.home.HomeFragment">


   <com.google.android.gms.maps.MapView
    android:id="@+id/mapView"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:ignore="MissingConstraints" />


   <ImageView
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"
           android:src="@drawable/ic_menu_orange"
           android:layout_margin="20dp"
           android:layout_alignParentBottom="true"
           android:layout_alignParentEnd="true">
   </ImageView>
</RelativeLayout>

另外,如果您希望它看起来像上面的图像,我建议您使用一个浮动操作按钮来代替imageview

我可以知道您面临的问题是什么吗?不清楚,不清楚。所有数据似乎都检索正确。如果问题在于在选定区域上显示按钮,那么很难找到目标,因为没有代码尝试在google Map上显示按钮。您的问题是什么???抽屉图像在设计视图中可见。但当我运行应用程序时,它在mapOP上不可见。它已经使用了ImageView,您的代码也是如此。看起来你只是在ImageView标记之前关闭了MapView,所以ImageView肯定不会被渲染到它应该在的地方。另外,如果您不确定ImageView,同时推荐一个按钮,那么最好包含一个代码、一个声明或至少一个带有按钮的伪代码。好的,我刚刚更改了ImageView约束,使图像右下对齐,如上图所示。但是图像将显示在地图的顶部,因为这是一个相对论。我离开ImageView是因为使用ImageView代替按钮可能还有其他未知原因。我假设上面的图像不是实际的应用程序,只是一个例子。首先,我在相对布局中使用imageview,但在设计布局中图像甚至不可见。您是否尝试过使用不同的绘图工具