android - 此项目无法访问,因为前一个项目(项目 #1)比此项目更通用

标签 android

此错误发生在 Android 开发中“此项目无法访问,因为前一个项目(项目 #1)比此项目更通用”。


<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/button1"></item>
<item android:state_pressed="true" 
    android:drawable="@drawable/buttonClick"></item>
<item android:state_selected="true" android:drawable="@drawable/buttonSelect"></item>
</selector>

最佳答案

During each state change, the state list is traversed top to bottom and the first item that matches the current state is used—the selection is not based on the "best match," but simply the first item that meets the minimum criteria of the state.

http://developer.android.com/guide/topics/resources/drawable-resource.html

您的第一个项目始终匹配,请将其放在最后

关于android - 此项目无法访问,因为前一个项目(项目 #1)比此项目更通用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17483414/

相关文章:

java - Android:从应用程序外部控制 MediaPlayer 实例(对象)?

Android:CardView 即将推出操作栏

java - 如何创建 Horizo​​ntalListView?

java - 为什么 Google Cloud Key Management Service 的 Java 客户端库不支持 Android?

android - 查看寻呼机 fragment 和选项卡不同步android

android - 关于 gradle.properties、settings.gradle、gradle-wrapper.properties 和 local.properties 的一些说明

java - 如何在使用覆盖时使按钮可点击

Android:ScrollView 与 NestedScrollView

java - 使用逐帧动画制作transitionX动画会导致滞后

android - 将时间选择器添加到日期选择器android