繁体   English   中英

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

[英]How to remove default shadow in ListItemPresenter in android TV

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

在此处输入图片说明

这是项目演示者的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。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM