Невозможно установить нижнее поле в данном макете - PullRequest
0 голосов
/ 09 мая 2018
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_alignParentRight="true"
    android:orientation="vertical"
    android:weightSum="2">

    <ScrollView
        android:id="@+id/gview1"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1.15"
        android:orientation="vertical"

        >

        <com.prolificinteractive.materialcalendarview.MaterialCalendarView
            android:id="@+id/calendarView"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:mcv_arrowColor="@color/colorPrimary"
            app:mcv_selectionColor="@color/colorPrimary" />

    </ScrollView>

    <LinearLayout
        android:id="@+id/gview2"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:orientation="vertical">

        <TextView
            android:id="@+id/headertext"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@+id/calendarView"
            android:background="#1d925c"
            android:gravity="center"
            android:padding="10dp"
            android:textColor="#ffffff" />

        <RelativeLayout
            android:id="@+id/rl_layout"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_below="@+id/headertext"
            android:layout_margin="10dp"
            android:background="@drawable/shadow"
            android:orientation="vertical">

            <fragment
                android:id="@+id/map"
                android:name="com.google.android.gms.maps.SupportMapFragment"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_below="@+id/caneclIcon" />

        </RelativeLayout>
    </LinearLayout>


</LinearLayout>

Это мой xml. Я установил фрагмент карты Google в нижнем макете, когда я установил поля равными 10, тогда я могу установить верхний, левый и правый значения, но снизу его не установить. Любой может подсказать, что я делаю неправильно. почему я не могу установить нижнее поле в данном XML.

1 Ответ

0 голосов
/ 09 мая 2018

Ваш weightSum равен 2, поэтому layout_weight обоих дочерних макетов в родительском макете должен совпадать с weightSum.

 <LinearLayout
    android:id="@+id/gview2"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight=".85"
    android:orientation="vertical">

изменить следующим образом, здесь layout_weight равен 0,85, Scrollview layout_weight равен 1,15, что составляет weightSum 2. и ваш marginBottom будет отражать

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