Android 获取xml中的系统属性
2018-05-11 本文已影响0人
Tang1024
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()