gpt4 book ai didi

android - Recyclerview item点击波纹效果

转载 作者:可可西里 更新时间:2023-11-01 18:49:48 27 4
gpt4 key购买 nike

<分区>

我正在尝试将 Ripple 效果添加到 RecyclerView 的项目。我在网上看了看,但找不到我需要的东西。我已经尝试将 android:background 属性添加到 RecyclerView 本身并将其设置为 "?android:selectableItemBackground" 但它不起作用。:

我的父布局是这样的

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp">

<android.support.v7.widget.RecyclerView
android:id="@+id/dailyTaskList"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clickable="true"
android:focusable="true"
android:scrollbars="vertical" />
</LinearLayout>

适配器模板如下所示

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:custom="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">

<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="5dp">

<TextView
android:id="@+id/txtTitle"
style="@style/kaho_panel_sub_heading_textview_style"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />

<TextView
android:id="@+id/txtDate"
style="@style/kaho_content_small_textview_style"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />

</LinearLayout>
</LinearLayout>

请给我解决方案

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com