您的位置:首页 > 产品设计 > UI/UE

Caused by: java.lang.UnsupportedOperationException: Can't convert value at index 1 to dimension

2018-03-06 16:08 519 查看
遇到这种报错。
public int getLayoutDimension(int index, int defValue) {
        if (mRecycled) {
            throw new RuntimeException("Cannot make calls to a recycled instance!");
        }

        index *= AssetManager.STYLE_NUM_ENTRIES;
        final int[] data = mData;
        final int type = data[index+AssetManager.STYLE_TYPE];
        if (type >= TypedValue.TYPE_FIRST_INT
                && type <= TypedValue.TYPE_LAST_INT) {
            return data[index+AssetManager.STYLE_DATA];
        } else if (type == TypedValue.TYPE_DIMENSION) {
            return TypedValue.complexToDimensionPixelSize(
                data[index+AssetManager.STYLE_DATA], mMetrics);
        }

        return defValue;

    }
发现是只在某个分辨率定义了dimen值 默认value没有定义。在其他分辨率下无值导致了崩溃
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  android
相关文章推荐