首页 > 解决方案 > Android Studio - 选择器中无法识别的 state_cheked 属性

问题描述

我是 Android Studio 和 Kotlin 的新手,我遇到了一个有趣的问题。

我的 Android Studio 无法识别某些属性。我找不到任何答案。

更新 Android Studio 和使用 Gradle 文件同步项目都没有帮助。

例如,在我的选择器中,属性state_chekedstate_pressed不起作用。

<?xml version="1.0" encoding="utf-8"?>
<selector 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">
    <item android:state_checked="true" android:drawable="@drawable/ic_home22"/>
    <item android:drawable="@drawable/ic_home22" android:state_pressed="false"/>
    <item android:drawable="@drawable/ic_home" />

</selector>

我得到的错误是Unknown attribute android:state_checked.

很高兴得到任何帮助,谢谢。

标签: androidkotlin

解决方案



推荐阅读