0

Всем привет, ребят. Разбираю для себя то что для меня не ясно. Например как на карту добавить View элемент? То есть карта и на ней была моя кнопка нажатия. И именно на ней чтоб на переднем фоне была кнопка на заднем карта, так же EditText ну и далее. И вообще как нужно ставить один View элемент поверх другого. Вы бы мне очень помогли, даже направив или коротко дав понять какой принцип...

4
  • 1
  • @AndrewGrow Это я знаю меня интересует вопрос однорго элемента поверх другого
    – elik
    21 фев 2017 в 14:43
  • хотите сказать через релятив или фрайм?)
    – elik
    21 фев 2017 в 14:44
  • 1
    да, эти два элемента очень помогут
    – Andrew G
    21 фев 2017 в 14:52

1 ответ 1

1

Карта отображается в специальном фрагменте SupportMapFragment. Соответственно вставьте этот фрагмент в ваш layout и в этот layout добавьте вам нужные View элементы

Пример:

<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: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" />

    <TextView
        android:id="@+id/search"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="@dimen/activity_horizontal_margin"
        android:background="@android:color/white"
        android:padding="@dimen/activity_horizontal_margin"
        android:text="@string/search"
        android:textColor="@android:color/darker_gray"
        tools:text="Search" />

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentEnd="true"
        android:layout_alignParentRight="true"
        android:layout_margin="@dimen/activity_horizontal_margin"
        android:orientation="vertical">

        <android.support.design.widget.FloatingActionButton
            android:id="@+id/myLocationBtn"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginBottom="@dimen/margin_between_fab"
            android:src="@drawable/ic_my_location_black_24dp"
            app:backgroundTint="@android:color/white"
            app:elevation="0dp" />

        <android.support.design.widget.FloatingActionButton
            android:id="@+id/addMarkerBtn"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:src="@drawable/ic_add_black_24dp"
            app:backgroundTint="@android:color/white"
            app:elevation="0dp"
            app:fabSize="mini" />
    </LinearLayout>

</RelativeLayout>
1
  • 1
    ААААААААААА понел понел !!!!!Спасибо !!!
    – elik
    22 фев 2017 в 12:45

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.