美文网首页Android 开发
Android 获取xml中的系统属性

Android 获取xml中的系统属性

作者: Tang1024 | 来源:发表于2018-05-11 10:50 被阅读0次

TypedArray ta = context.obtainStyledAttributes(attrs, new int[] {

                android.R.attr.layout_width, android.R.attr.layout_height });

String w = ta.getString(0);

        String h = ta.getString(1);

        if (w.indexOf("-2") > -1) {

            throw new IllegalArgumentException(

                    "the UISwitch only can run exactly screen");

        }

        if (h.indexOf("-2") > -1) {

            throw new IllegalArgumentException(

                    "the UISwitch only can run exactly screen");

        }

ta.recirle()

相关文章

网友评论

    本文标题:Android 获取xml中的系统属性

    本文链接:https://www.haomeiwen.com/subject/qbxfdftx.html