如何在Android TV中的ListItemPresenter中删除默认阴影

问题描述

如何删除ListItemPresenter中的认黑色阴影(黑色阴影或每个角), 演示者视图的附加图像

enter image description here

这是项目演示者的xml

<?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"
    xmlns:tools="http://schemas.android.com/tools"
    android:background="@android:color/transparent"
    app:cardCornerRadius="16dp"
    android:layout_width="200dp"
    android:layout_height="200dp">

    <androidx.cardview.widget.CardView
        android:background="@android:color/transparent"
        app:cardCornerRadius="8dp"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_margin="8dp">

        <androidx.constraintlayout.widget.ConstraintLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@drawable/block_bg_state"
            android:gravity="center"
            android:orientation="vertical">

            ...


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

解决方法

如果您不需要阴影,则无需使用CardView。这是“包装器”,用于在其持有的视图中添加高程(阴影)和圆角。

如果这是完整的布局,则还可以删除LinearLayout并将布局的宽度/高度直接添加到ConstraintLayout中。

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...