Пустое пространство между макетами - PullRequest
0 голосов
/ 23 ноября 2018

У меня проблема с пустым пространством между макетами:

screen

Проблема в том, что между этим идентификатором и улицей (эта тонкая линия) в этом пространствеанимация клика не отображается.android: layout_below, вероятно, будет работать здесь, но его нельзя использовать для макета.Это код макета:

<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_height="wrap_content"
    android:layout_width="wrap_content"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:clickable="false">

    <android.support.v7.widget.CardView
        android:id="@+id/fullCardView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:cardCornerRadius="3dp"
        android:elevation="5dp"

        >

        <LinearLayout
            android:id="@+id/linearID"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            >
            <TextView
                android:id="@+id/tvFullId"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:paddingStart="10dp"
                android:paddingTop="5dp"
                android:gravity="end"
                android:background="?android:attr/selectableItemBackground"
                android:paddingEnd="20dp"
                android:textSize="16dip"
                android:text="Id"
                android:clickable="false"/>
        </LinearLayout>
        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:paddingTop="30dp">
            <TextView
                android:id="@+id/tvFullStreet"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:gravity="end"
                android:background="?android:attr/selectableItemBackground"
                android:paddingEnd="20dp"
                android:paddingStart="10dip"
                android:paddingTop="15dp"
                android:textSize="16dip"
                android:text="street"
                android:clickable="false"/>

            <TextView
                android:id="@+id/tvFullCity"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:gravity="end"
                android:paddingEnd="20dp"
                android:background="?android:attr/selectableItemBackground"
                android:layout_below="@id/tvFullStreet"
                android:paddingBottom="10dp"
                android:paddingStart="10dip"
                android:textSize="16dip"
                android:text="city"
                android:clickable="false"/>
        </RelativeLayout>
        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:paddingStart="10dp">

            <TextView
                android:id="@+id/tvFullEndDate"
                android:layout_width="200dp"
                android:layout_height="match_parent"
                android:paddingTop="5dp"
                android:textSize="16dip"
                android:text="end date"
                android:clickable="false"/>

            <TextView
                android:id="@+id/tvTimeFullLeft"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:gravity="bottom"
                android:layout_below="@id/tvFullEndDate"
                android:paddingTop="30dp"
                android:paddingBottom="5dp"
                android:text="Ważne przez: "/>
        </RelativeLayout>

    </android.support.v7.widget.CardView>

</RelativeLayout>

Я думаю, что это может быть из-за paddingTop="30dp" внутри RelativeLayout, но я не знаю, как его решить.

Ответы [ 2 ]

0 голосов
/ 23 ноября 2018

Я думаю, что ваш xml должен быть таким,

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:clickable="false">

    <android.support.v7.widget.CardView
        android:id="@+id/fullCardView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:elevation="5dp"
        app:cardCornerRadius="3dp"

        >

        <LinearLayout
            android:id="@+id/linearID"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">

            <TextView
                android:id="@+id/tvFullId"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="?android:attr/selectableItemBackground"
                android:clickable="false"
                android:gravity="end"
                android:paddingStart="10dp"
                android:paddingTop="5dp"
                android:paddingEnd="20dp"
                android:text="Id"
                android:textSize="16dip" />

            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content">

                <TextView
                    android:id="@+id/tvFullStreet"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:background="?android:attr/selectableItemBackground"
                    android:clickable="false"
                    android:gravity="end"
                    android:paddingStart="10dip"
                    android:paddingTop="15dp"
                    android:paddingEnd="20dp"
                    android:text="street"
                    android:textSize="16dip" />

                <TextView
                    android:id="@+id/tvFullCity"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_below="@id/tvFullStreet"
                    android:background="?android:attr/selectableItemBackground"
                    android:clickable="false"
                    android:gravity="end"
                    android:paddingStart="10dip"
                    android:paddingEnd="20dp"
                    android:paddingBottom="10dp"
                    android:text="city"
                    android:textSize="16dip" />
            </RelativeLayout>

            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:paddingStart="10dp">

                <TextView
                    android:id="@+id/tvFullEndDate"
                    android:layout_width="200dp"
                    android:layout_height="match_parent"
                    android:clickable="false"
                    android:paddingTop="5dp"
                    android:text="end date"
                    android:textSize="16dip" />

                <TextView
                    android:id="@+id/tvTimeFullLeft"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_below="@id/tvFullEndDate"
                    android:gravity="bottom"
                    android:paddingTop="30dp"
                    android:paddingBottom="5dp"
                    android:text="Ważne przez: " />
            </RelativeLayout>

        </LinearLayout>
    </android.support.v7.widget.CardView>

</RelativeLayout>
0 голосов
/ 23 ноября 2018

Проблема возникает из-за того, что вы устанавливаете отступ в относительном макете 30dp,

Измените это

 <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:paddingTop="30dp">

С

 <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dp">
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...