状态栏 a.getBoolean(1, false) 报错

这个错误在编译运行时候并不会出现,但是当需要编译打包的时候,就会报出这个异常。

TypedArray a = mContext.obtainStyledAttributes(attrs);
boolean hasBottomLine = a.getBoolean(0, false);
boolean hasTopLine = a.getBoolean(1, false);//AS会在"1"下显示错误红线.

解决方案:

在该方法上添加@SuppressWarnings("ResourceType"),这样即可过滤该警告,可以正常通过签名编译。

相关文章:

  • 2021-10-11
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-24
  • 2022-12-23
  • 2021-10-16
  • 2021-08-23
猜你喜欢
  • 2021-05-28
  • 2021-12-28
  • 2021-12-30
  • 2021-12-19
  • 2022-01-22
相关资源
相似解决方案