@Override
        public void attr(String ns, String name, int resourceId, int type, Object value) {
            if (name == null) {
                throw new RuntimeException("name can't be null");
            }
            Attr a = new Attr(ns == null ? null : new StringItem(ns), new StringItem(name), resourceId);
            a.type = type;

            if (value instanceof ValueWrapper) {
                ValueWrapper valueWrapper = (ValueWrapper) value;
                if (valueWrapper.raw != null) {
                    a.raw = new StringItem(valueWrapper.raw);
                }
                a.value = valueWrapper.ref;
                switch (valueWrapper.type) {
                    case ValueWrapper.CLASS:
                        clz = a;
                        break;
                    case ValueWrapper.ID:
                        id = a;
                        break;
                    case ValueWrapper.STYLE:
                        style = a;
                        break;
                }
            } else if (type == TYPE_STRING) {
                StringItem raw = new StringItem((String) value);
                a.raw = raw;
                a.value = raw;

            } else {
                a.raw = null;
                a.value = value;
            }

            onAttr(a);

        }
a class to write android axml

@author <a href="mailto:pxb1988@gmail.com">Panxiaobo</a>
android/third_party/apkbuilder/src/main/java/pxb/android/axml/AxmlWriter.java