看看这个代码 fragment 。 最后一行出现错误,因为我传递的是“索引”而不是资源。我认为这是一个 lint 问题并试图压制它。 然后我注意到只有在构建发布时才会收到此错误。在构建调试时它工作正常。我完全一无所知。任何人都可以对我做错的事情有所了解。
//Get paddingLeft, paddingRight
int[] attrsArray = new int[]{
android.R.attr.paddingLeft, // 0
android.R.attr.paddingRight, // 1
};
TypedArray ta = context.obtainStyledAttributes(attrs, attrsArray);
if (ta == null) return;
mPaddingLeft = ta.getDimensionPixelSize(0, 0);
mPaddingRight = ta.getDimensionPixelSize(1/*error here*/, 0);
最佳答案
我在尝试构建已签名的 apk 时遇到了同样的问题。
通过添加 @SuppressWarnings("ResourceType")
来抑制警告来解决它,现在它可以正常工作了。
关于android - 错误 : Expected resource of type styleable [ResourceType] error,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36254914/