在Android库中不能使用switch-case语句访问资源ID

xiaoxiao2021-02-27  211

在Android项目中,点击事件一般都是实现接口OnClickListener 的onClick,然后通过switch-case语句访问资源id.如下图

但是在写Android依赖库时候发现居然不能使用报错了

非常莫名其妙的问题呢,不过错误提示说的很明白了 the constants are not final in a library project. lib库中的常量没有final修饰,所以必须修改,修改方法也给出,修改成if else就好

转载请注明原文地址: https://www.6miu.com/read-16794.html

最新回复(0)