android - 如何在 Android TV 的 ListItemPresenter 中删除默认阴影
问题描述
如何删除默认的黑色阴影(黑色阴影或每个角落)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。
推荐阅读
- c# - MediaPlayerElement.MediaPlayer.PlaybackSession.NaturalDuration 始终返回零
- c++ - “this”在父类(c++)中指向哪里?
- android - 如何在微调器中通过改造显示 response.body 形式
- azure-machine-learning-studio - 将 Azure ML 部署到自定义 kubernetes
- julia - 如何防止 Flux.jl 分配我的 GPU 的全部内存?
- jupyter-notebook - jupyter notebook 错误的本地转发规范 'notebook:127.0.0.1:notebook'
- java - 关于字节数组写入如何在 Java 中工作的困惑
- sql - SQL查询以查找分支机构的详细信息和每个分支机构的帐户数
- node.js - 使用 Prisma.js 按标签 ID 获取帖子
- clojure - 您如何使用 deps.edn 引用或重用另一个别名?