内容的布局不适合Android 4.4上的CardView

问题描述

我遇到了以下问题:我有一个视图寻呼机,它的每个元素都是CardView。这是适配器元素的布局:

<?xml version="1.0" encoding="utf-8"?>
<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:background="@color/transparent"
    android:orientation="vertical">

    <androidx.cardview.widget.CardView
        style="@style/LoanHistoryCardViewStyle"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:cardBackgroundColor="@color/white"
        app:cardUseCompatPadding="true">

        <LinearLayout
            android:id="@+id/ll_info"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_marginLeft="@dimen/default_margin"
            android:layout_marginTop="@dimen/loan_history_content_margin_top"
            android:layout_marginRight="@dimen/default_margin"
            android:orientation="vertical">

            <TextView
                android:id="@+id/tv_history_title"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:ellipsize="end"
                android:lineSpacingExtra="@dimen/line_spacing_extra_4_sp"
                android:singleLine="true"
                android:textColor="@color/default_light_green"
                android:textSize="@dimen/default_text_size_16" />

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="@dimen/margin_10"
                android:orientation="horizontal">

                <TextView
                    style="@style/LoanHistoryTitleStyle"
                    android:layout_width="@dimen/zero_dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="@dimen/loan_history_sum_0_6"
                    android:text="@string/loan_history_contract_number_title" />

                <TextView
                    android:id="@+id/tv_loan_history_loan_id"
                    style="@style/LoanHistoryTextValueStyle"
                    android:layout_width="@dimen/zero_dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="@dimen/loan_history_sum_0_4" />

            </LinearLayout>


            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="@dimen/loan_history_text_value_margin_top"
                android:orientation="horizontal">

                <TextView
                    style="@style/LoanHistoryTitleStyle"
                    android:layout_width="@dimen/zero_dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="@dimen/loan_history_sum_0_6"
                    android:text="@string/loan_history_date_acceptance_title" />

                <TextView
                    android:id="@+id/tv_loan_history_loan_date_acceptance"
                    style="@style/LoanHistoryTextValueStyle"
                    android:layout_width="@dimen/zero_dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="@dimen/loan_history_sum_0_4" />
            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="@dimen/loan_history_text_value_margin_top"
                android:orientation="horizontal">

                <TextView
                    style="@style/LoanHistoryTitleStyle"
                    android:layout_width="@dimen/zero_dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="@dimen/loan_history_sum_0_6"
                    android:text="@string/loan_history_return_date_title" />

                <TextView
                    android:id="@+id/tv_loan_history_loan_return_date"
                    style="@style/LoanHistoryTextValueStyle"
                    android:layout_width="@dimen/zero_dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="@dimen/loan_history_sum_0_4" />
            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="@dimen/loan_history_text_value_margin_top"
                android:orientation="horizontal">

                <TextView
                    style="@style/LoanHistoryTitleStyle"
                    android:layout_width="@dimen/zero_dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="@dimen/loan_history_sum_0_6"
                    android:text="@string/loan_history_loan_payments_schedule" />

                <TextView
                    android:id="@+id/tv_loan_history_loan_payments_schedule"
                    style="@style/LoanHistoryTextValueStyle"
                    android:layout_width="@dimen/zero_dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="@dimen/loan_history_sum_0_4" />
            </LinearLayout>

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

                <TextView
                    style="@style/LoanHistoryTitleStyle"
                    android:layout_width="@dimen/zero_dp"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center_vertical"
                    android:layout_weight="@dimen/loan_history_sum_0_6"
                    android:text="@string/loan_history_payment_calendar_title" />

                <TextView
                    android:id="@+id/tv_loan_history_loan_payment_calendar"
                    style="@style/LoanHistoryTextValueStyle"
                    android:layout_width="@dimen/zero_dp"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center_vertical"
                    android:layout_weight="@dimen/loan_history_sum_0_4"
                    android:background="?selectableItemBackground"
                    android:clickable="true"
                    android:focusable="true"
                    android:gravity="center_vertical"
                    android:paddingTop="@dimen/margin_4"
                    android:paddingBottom="@dimen/margin_4"
                    android:text="@string/loan_history_show_calendar_title" />
            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="@dimen/loan_history_text_value_margin_top"
                android:orientation="horizontal">

                <TextView
                    style="@style/LoanHistoryTitleStyle"
                    android:layout_width="@dimen/zero_dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="@dimen/loan_history_sum_0_6"
                    android:text="@string/loan_history_loan_status_title" />

                <TextView
                    android:id="@+id/tv_loan_history_loan_loan_status"
                    style="@style/LoanHistoryTextValueStyle"
                    android:layout_width="@dimen/zero_dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="@dimen/loan_history_sum_0_4" />
            </LinearLayout>

            <TextView
                android:id="@+id/tv_loan_history_download_contract"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="@dimen/loan_history_text_doc_margin_top"
                android:paddingTop="@dimen/loan_history_text_value_margin_top"
                android:paddingBottom="@dimen/loan_history_text_value_margin_top"
                android:text="@string/loan_history_download_contract_title"
                android:textColor="@color/loan_history_value"
                android:textSize="@dimen/default_text_size_14" />

        </LinearLayout>
    </androidx.cardview.widget.CardView>


</LinearLayout>

在预览中,它看起来像这样:

enter image description here

例如,当我在Android 9上运行该应用程序时,一切看起来都正确:

enter image description here

但是当我在Android 4.4上运行它时,它看起来像这样:

enter image description here

因此,如您所见,底部的TextView不可见。我认为此问题是由于Android 5.0中的海拔高度变化引起的,但是我不知道该如何解决。感谢您的帮助,谢谢!

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...