android:background 白色,android:attr / selectableItemBackground在白色windowBackground上不起作用...

我想用

?android:attr/selectableItemBackground

我的recyclerview的项目.不幸的是,它不起作用.我的styles.xml文件中包含以下行:

@color/white

没有这条线,我可以看到波纹,这意味着背景os由于窗口背景很白而无法正常工作.如何强制在我的白色背景上出现涟漪效果?

这是recyclerview项目的布局:

android:id="@+id/brand_row"

xmlns:android="http://schemas.android.com/apk/res/android"

android:layout_width="match_parent"

android:layout_height="?android:attr/listPreferredItemHeight"

android:background="?android:attr/selectableItemBackground"

android:orientation="vertical">

android:layout_width="match_parent"

android:layout_height="0dp"

android:layout_marginLeft="@dimen/activity_horizontal_margin"

android:layout_weight="1"

android:gravity="center_vertical"

android:orientation="vertical">

android:id="@+id/name"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:ellipsize="marquee"

android:singleLine="true"

android:textColor="@color/modelTitelColor"

android:textStyle="bold"/>

android:id="@+id/numbers"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:ellipsize="marquee"

android:singleLine="true"

android:textColor="@color/cardview_background"

android:textStyle="normal"/>

android:layout_width="match_parent"

android:layout_height="1dp"

android:background="@color/divider"/>

我的minSdkVersion是14

解决方法:

在我的styles.xml中

Theme.AppCompat.NoActionBar

作为父主题.更改为

style name="CustomMaterialTheme" parent="Theme.AppCompat.Light.NoActionBar"

解决了问题.现在我可以看到效果了.

标签:android-recyclerview,android

来源: https://codeday.me/bug/20191027/1942000.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值