Resources.getSystem().getInteger(android.R.attr.state_expanded)引发NotFoundException
我试图摆弄组指示符,因此将部分源代码用于ExpandableListView。我有一行代码:Resources.getSystem().getInteger(android.R.attr.state_expanded)引发NotFoundException,android,android-resources,Android,Android Resources,我试图摆弄组指示符,因此将部分源代码用于ExpandableListView。我有一行代码: /** State indicating the group is expanded and empty (has no children). */ private static final int[] GROUP_EXPANDED_EMPTY_STATE_SET = {Resources.getSystem().getInteger(android.R.attr.sta
/** State indicating the group is expanded and empty (has no children). */
private static final int[] GROUP_EXPANDED_EMPTY_STATE_SET =
{Resources.getSystem().getInteger(android.R.attr.state_expanded), Resources.getSystem().getInteger(android.R.attr.state_empty)};
但这总是引发NotFoundException。我做错了什么?解决方法是简单地使用:
/** State indicating the group is expanded and empty (has no children). */
private static final int[] GROUP_EXPANDED_EMPTY_STATE_SET =
{android.R.attr.state_expanded, android.R.attr.state_empty};
您不需要Resources.getSystem()部分您对非静态常量尝试过相同的声明吗?是的。。如果只在数组中添加资源标识符,仍然不起作用。不是那些资源ID引用的值。