首页 > 解决方案 > 指针图标可以像其他视图一样在 RecyclerView 上设置吗?

问题描述

我已经在我使用过的所有按钮和约束布局上设置了指针图标,但我不知道如何在 recyclerview 项目上设置指针图标。如何在 recyclerview 项目上实现鼠标指针图标?

我试图在膨胀视图上实现指针图标,但它没有用。

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="28dp"
    android:layout_height="28dp"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:orientation="vertical"
    android:layout_marginTop="2dp"
    android:layout_marginBottom="2dp"
    android:layout_marginStart="3dp"
    android:layout_marginEnd="3dp"
    android:pointerIcon="hand"
    >

    <ImageView
        android:id="@+id/img_icon_social_apps"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        android:pointerIcon="hand"
        />

</android.support.constraint.ConstraintLayout>

我希望当鼠标悬停在 recyclerview 内的项目上时指针图标会改变。

标签: androidandroid-recyclerview

解决方案


推荐阅读