0

Дано:

RecyclerView с элементами CardView. В каждом CardView есть 3 элемента - 1 LinearLayout и 2 RelativeLayout. В 2х RelativeLayout добавлены разделительная линия в виде View.

Минимальная версия API: 15

Максимальная: 23

Проблема:

При запуске приложения, в версии 5.0 и выше, всё отображается корректно. введите сюда описание изображения

Но, при запуске приложения на 4.0 появляются лишние девайдеры: введите сюда описание изображения

Вопрос:

Как убрать их в Android версии 4.0-4.1 и привести к такому же виду, как в 5.0?

item.xml

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


<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/cvChatRoom"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:cardBackgroundColor="@color/cardview_light_background">


    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="horizontal"
        android:layout_marginTop="7dp"
        android:layout_marginLeft="12dp"
        android:layout_marginBottom="7dp"


        >


        <LinearLayout
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1">


            <com.mikhaellopez.circularimageview.CircularImageView
                android:id="@+id/civChat"
                android:layout_width="60dp"
                android:layout_height="60dp"
                android:padding="4dp"
                app:civ_border_width="1dp"
                app:civ_shadow="true"
                app:civ_shadow_color="#3f51b5"
                app:civ_shadow_radius="0" />


        </LinearLayout>

        <RelativeLayout
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="3">


            <TextView
                android:id="@+id/twItemChatName"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textColor="@color/colorChatName"
                android:textSize="16sp"
                android:textStyle="bold"

                />

            <TextView
                android:id="@+id/twLastMessageOrStatus"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@+id/twItemChatName"
                android:textSize="14sp" />

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


                <LinearLayout
                    android:id="@+id/linearLayoutEventInfo"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:orientation="horizontal"
                    android:visibility="gone">


                    <com.mikhaellopez.circularimageview.CircularImageView
                        android:id="@+id/civItemType"
                        android:layout_width="30dp"
                        android:layout_height="30dp"
                        android:padding="4dp"
                        app:civ_border_width="1dp"
                        app:civ_shadow="true"
                        app:civ_shadow_color="#3f51b5"
                        app:civ_shadow_radius="0" />

                    <TextView
                        android:id="@+id/twQuantityOfMembers"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content" />


                </LinearLayout>


            </LinearLayout>



            <View
                android:layout_width="match_parent"
                android:layout_height="1dp"
                android:background="@color/colorToolbarLine"
                android:layout_alignParentBottom="true"/>

        </RelativeLayout>

        <RelativeLayout
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:orientation="vertical"

            >


            <TextView
                android:id="@+id/twLastMessageData"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentRight="true"
                android:layout_marginRight="12dp"
                />


            <View
                android:layout_width="match_parent"
                android:layout_height="1dp"
                android:background="@color/colorToolbarLine"
                android:layout_alignParentBottom="true"/>

        </RelativeLayout>


    </LinearLayout>


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

activity.xml

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

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/background"


    >


    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:id="@+id/activity_chats"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        tools:context="ru.techmas.getmeet.activities.ChatsActivity"

        >
        <include layout="@layout/toolbar" />


        <android.support.v7.widget.RecyclerView

            android:id="@+id/rwChatList"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:paddingBottom="5dp"
            android:paddingTop="5dp"

            />

    </LinearLayout>

    <include layout="@layout/footer_main" />
</RelativeLayout>

1 ответ 1

1

Решил проблему с линиями путём добавления в CardView:

    card:cardUseCompatPadding="true"
    app:cardPreventCornerOverlap="false"
    app:cardMaxElevation="0dp"
    app:cardElevation="0dp"
1
  • Этл, также, возможно, результат прозрачности фона карточки
    – ЮрийСПб
    25 авг 2016 в 14:07

Ваш ответ

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

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