android - CardView for Android 9.0 有空格黑空白,怎么去掉黑空格
问题描述
CardView for Android 有空格,如何去除。我需要帮助。这是java或android问题。
<android.support.v7.widget.CardView
android:id="@+id/cv_result_knowledge"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/ll_result_header"
android:clickable="true"
android:foreground="?android:attr/selectableItemBackground"
android:visibility="gone"
app:cardBackgroundColor="@color/black_transparent40"
app:cardCornerRadius="@dimen/d12"
app:cardElevation="@dimen/d1"
app:cardPreventCornerOverlap="false"
app:cardUseCompatPadding="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/d10"
android:layout_marginTop="@dimen/d2">
</RelativeLayout>
</android.support.v7.widget.CardView>
解决方案
这是因为您将背景颜色设置为黑色,您的相对布局设置了边距,因此黑色卡片背景在边距区域中可见。只需删除卡片背景或删除边距,以适合您的方式。
<android.support.v7.widget.CardView
android:id="@+id/cv_result_knowledge"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/ll_result_header"
android:clickable="true"
android:foreground="?android:attr/selectableItemBackground"
android:visibility="gone"
app:cardBackgroundColor="@color/black_transparent40" -<REMOVE THIS
app:cardCornerRadius="@dimen/d12"
app:cardElevation="@dimen/d1"
app:cardPreventCornerOverlap="false"
app:cardUseCompatPadding="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/d10" -<REMOVE THIS
android:layout_marginTop="@dimen/d2"> -<REMOVE THIS
推荐阅读
- html - 在 fxFlex 中使用 calc() 不能在边缘工作
- qt - 如何在同一设备上分别处理两个鼠标?
- python - 如何在 python 中使用 Scrapy 抓取网站以获取网站中的所有链接?
- java - 如何从以前缀开头的表中选择值
- python - 从具有固定行号的数据帧中子集数据帧
- uart - 如何在 ESP32 UART Rx PORT 上一次接收更多数据(大于,>128)?
- angular - 应用程序没有显示对话框,我的应用程序将对话框显示为页面上的组件
- java - Spring Security - 401 Unauthorized for token end point (/oauth/token)
- php - PHP Apache .htaccess URL 重写多个变量
- r - 如何计算周末天数