Resources.getSystem()。getInteger(android.R.attr.state_expanded)抛出NotFoundException

时间:2014-03-16 10:39:18

标签: 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.state_expanded), Resources.getSystem().getInteger(android.R.attr.state_empty)};

但是这总是会抛出NotFoundException。我做错了什么?

1 个答案:

答案 0 :(得分:0)

解决方法是简单地使用:

 /** 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};

您不需要Ressources.getSystem()部分