android - 项目 API 19 之间的 Recyclerview 差距
问题描述
我正在做一个小型应用程序并且正在使用 aRecyclerView
但是当我在 API 19 上模拟我的应用程序时,项目之间的差距很小,但是如果我在 API 22 上运行相同的应用程序,则没有差距(最后有一个屏幕)。
我正在使用材料设计
frag_home xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_videos"
android:layout_height="match_parent"
android:layout_width="match_parent"
tools:listitem="@layout/item_video"
/>
</LinearLayout>
item_card xml
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.material.card.MaterialCardView xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/card"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardCornerRadius="0dp"
app:cardPreventCornerOverlap="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<ImageView
android:id="@+id/video_preview"
android:layout_width="match_parent"
android:layout_height="194dp"
android:scaleType="centerCrop"
tools:src="@drawable/img_error_v1"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="16dp">
<TextView
android:id="@+id/video_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?attr/textAppearanceHeadline6"
android:maxLines="1"
tools:text="This is a really really really really really really really really really really really long title"
/>
<TextView
android:id="@+id/video_description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:maxLines="1"
android:textAppearance="?attr/textAppearanceBody2"
android:textColor="?android:attr/textColorSecondary"
tools:text="This is the URL for now"
/>
</LinearLayout>
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
这是图像,左边是 API 22,右边是 API 19
解决方案
对于我的应用程序,我不需要使用,CardView
因此我将它们更改为LinearLayout
.
您可以查看这些帖子以了解更多关于CardView
和layout
推荐阅读
- d3.js - D3 - 工具提示上的 html 结构
- spring-integration - Spring Integration 发送消息直到触发自定义事件
- c# - 将对象添加到列表会导致覆盖所有以前的值,尽管在循环中进行了新的实例化
- android - 观察者 onChanged() 不发送最新的值集
- ngxs - 测试 ngxs 状态类
- vim - gVim:基于插入内容的自动注释
- python - Python - 尝试替换包含“”的文本字符串
- c++ - 平面/射线交点与点/平面投影的差异
- r - 在 R 中一次运行多个条件
- logstash - Lagstash 时间戳 dateparseerror