Проблема с отображением кнопки на Google Maps android - PullRequest
0 голосов
/ 16 марта 2020

Я использую карты Google в android. Попытка создать макет с помощью карты Google и некоторых других виджетов на экране, таких как значок ящика. Вот мой 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>

UI design

1 Ответ

0 голосов
/ 16 марта 2020

Я работал с картами, но не с картами Google. В любом случае, вы пытались поместить изображение в относительное расположение, а не в MapView? RelativeLayouts созданы для этой цели, поэтому элементы init могут перекрываться. не уверен, что просмотр карт Google Maps примет 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>

плюс, если вы хотите, чтобы он выглядел так же, как на изображении выше, я бы рекомендовал использовать FloatingActionButton вместо imageview

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...