Android examples for android.util:AttributeSet
get Attribute Boolean Value
//package com.java2s; import android.util.AttributeSet; public class Main { public static boolean getAttributeBooleanValue(AttributeSet attrs, String namespace, String attribute, boolean defValue) { boolean ret = defValue; if (attrs != null) { ret = attrs.getAttributeBooleanValue(namespace, attribute, defValue);/*w ww. j a v a 2 s .c o m*/ if (ret != defValue) { return ret; } ret = attrs.getAttributeBooleanValue(namespace, attribute, !defValue); if (ret != (!defValue)) { return ret; } String temp = null; int count = attrs.getAttributeCount(); for (int i = 0; i < count; i++) { temp = attrs.getAttributeName(i); if (temp.equals(attribute)) { ret = attrs.getAttributeBooleanValue(i, defValue); break; } } } return ret; } }