RecyclerView last Item does not show entirely the item, because of the above TabLayout Code Answer

I have a RecyclerView that does not show the last item, I know there are a lot of similar posts, but is all the day I am trying to make changes without success in the file, I guess the main reason could be the TabView because without it, it works like a charm. The RecyclerView is called by the include below..

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 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"
    android:background="@color/cardViewBackground">

    <android.support.design.widget.TabLayout
        android:id="@+id/address_filter_tl"
        android:layout_width="match_parent"
        android:layout_height="48dp"
        android:layout_gravity="start"
        android:background="@color/colorPrimary"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:tabGravity="fill"
        app:tabIndicatorColor="@color/primaryWhite"
        app:tabMode="fixed"
        app:tabSelectedTextColor="@color/primaryWhite"
        app:tabTextColor="@color/inactiveTabText"
        android:layout_marginBottom="?attr/actionBarSize">

        <android.support.design.widget.TabItem
            android:id="@+id/search_results_tab"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/search_result" />

        <android.support.design.widget.TabItem
            android:id="@+id/address_book_tab"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/address_book" />

    </android.support.design.widget.TabLayout>

    <android.support.v7.widget.CardView
        android:id="@+id/my_location_cv"
        android:layout_width="0dp"
        android:layout_height="72dp"
        android:layout_marginStart="8dp"
        android:layout_marginTop="16dp"
        android:layout_marginEnd="8dp"
        android:layout_marginBottom="8dp"
        android:clickable="true"
        android:focusable="true"
        app:cardElevation="2dp"
        app:layout_constraintBottom_toTopOf="@id/search_results_cv"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@id/address_filter_tl">

        <android.support.constraint.ConstraintLayout
            android:id="@+id/my_location_cl"
            android:layout_width="match_parent"
            android:layout_height="match_parent">

            <ImageView
                android:layout_width="24dp"
                android:layout_height="24dp"
                android:layout_margin="16dp"
                app:layout_constraintBottom_toBottomOf="@id/my_location_cl"
                app:layout_constraintStart_toStartOf="@id/my_location_cl"
                app:layout_constraintTop_toTopOf="@id/my_location_cl"
                app:srcCompat="@drawable/ic_my_location"
                tools:ignore="ContentDescription" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginStart="72dp"
                android:text="@string/my_location"
                android:textColor="@color/primaryBlack"
                android:textSize="16sp"
                app:layout_constraintBottom_toTopOf="@id/guideline"
                app:layout_constraintStart_toStartOf="parent" />

            <TextView
                android:id="@+id/my_location_address_tv"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_marginStart="72dp"
                android:layout_marginEnd="16dp"
                android:ellipsize="end"
                android:maxLines="1"
                android:textColor="@color/primaryGreyText"
                android:textSize="14sp"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@id/guideline"
                tools:text="7331 GA Apeldoorn" />

            <android.support.constraint.Guideline
                android:id="@+id/guideline"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="horizontal"
                app:layout_constraintGuide_begin="36dp" />

        </android.support.constraint.ConstraintLayout>

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

    <include
        android:id="@+id/search_results_cv"
        layout="@layout/addresses_card_view"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_margin="8dp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@id/my_location_cv" />

    <android.support.v7.widget.AppCompatImageView
        android:id="@+id/appCompatImageView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="8dp"
        android:layout_marginBottom="8dp"
        android:layout_marginTop="8dp"
        app:layout_goneMarginBottom="8dp"
        android:src="@drawable/powered_by_google"
        app:layout_constraintTop_toBottomOf="@id/search_results_cv"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent" />

</android.support.constraint.ConstraintLayout>

this is the include content layout:

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 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:clipToPadding="false"
    android:layout_height="wrap_content">

    <android.support.v7.widget.RecyclerView
        android:id="@+id/addresses_rv"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:paddingTop="0dp"
        android:paddingBottom="0dp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        tools:listitem="@layout/address_item" />

</android.support.constraint.ConstraintLayout>

Answer

change your include xml as below, set layout_height="0dp" and also set bottom constraint for it. Check if it works.

<include
        android:id="@+id/search_results_cv"
        layout="@layout/addresses_card_view"
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:layout_margin="8dp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@id/my_location_cv"
        app:layout_constraintBottom_toBottomOf="parent" />

Related Posts

© No Copyrights, All Questions are retrived from public domain.
Tutorial Guruji