public boolean containsAttributes(AttributeSet attributes) { int attrCount = attributes.getAttributeCount(); return (attrCount == 0) || (attrCount == 1) && (NAME.equals(attributes.getAttribute(NameAttribute))); }
XmlPullParser parser = getResources().getXml(R.xml.test); try { parser.next(); parser.nextTag(); } catch (Exception e) { e.printStackTrace(); } AttributeSet attr = Xml.asAttributeSet(parser); int count = attr.getAttributeCount();
public boolean isEqual(AttributeSet attr) { return (attr.getAttributeCount() == 1) && NAME.equals(attr.getAttribute(NameAttribute)); }
public TimeDialogPreference(Context context, AttributeSet attrs) { super(context, attrs); for (int i=0;i<attrs.getAttributeCount();i++) { String attr = attrs.getAttributeName(i); String val = attrs.getAttributeValue(i); if (attr.equalsIgnoreCase("step")) { Log.i("TimeDialogPreference", "step = "+val); } } }
private int getTextAppearance(AttributeSet attrs, int defStyle) { int answer = defStyle; for(int i=0; i<attrs.getAttributeCount(); i++) { if(attrs.getAttributeNameResource(i) == android.R.attr.textAppearance) { String attrStringValue = attrs.getAttributeValue(i); if(attrStringValue != null) { attrStringValue = attrStringValue.replace("?", ""); answer = Integer.parseInt(attrStringValue); } } } return answer; }
public SeekBarPreference1(Context context, AttributeSet attrs) { super(context, attrs); _preferences = PreferenceManager.getDefaultSharedPreferences(context); // Save your shared prefs here // I saved the seekbar max && current value // Something like below for (int i = 0; i < attrs.getAttributeCount(); i++) { if (attrs.getAttributeName(i).equals("max")) _preferences.edit().putString(getKey() +"Max", ""+ attrs.getAttributeValue(i)).commit(); } }
super(context, attrs); for (int i=0; i<attrs.getAttributeCount(); ++i) { String attr = attrs.getAttributeName(i);
public FoodButton(Context context, AttributeSet attrs) { super(context, attrs); for (int i=0;i<attrs.getAttributeCount();i++) { switch (attrs.getAttributeName(i)) { case "state_baked": mIsBaked = attrs.getAttributeBooleanValue(i, false); break; case "state_fried": mIsFried = attrs.getAttributeBooleanValue(i, false); break; } } }
for (int i = 0; i < attrs.getAttributeCount(); i++)
super(context, attrs); for (int i=0; i<attrs.getAttributeCount(); ++i) { String attr = attrs.getAttributeName(i);
AttributeSet attribs = getDocumentElement().getAttributes(); if(attribs.getAttributeCount() > 0) { String attribsText = getAttribsText(); if(SVGNavigatorTree.showAttributes) {
public class MyTextView extends TextView { Context context; String ttfName; public MyTextView(Context context, AttributeSet attrs) { super(context, attrs); this.context = context; for (int i = 0; i < attrs.getAttributeCount(); i++) { this.ttfName = attrs.getAttributeValue("http://schemas.android.com/apk/res/com.package.my", "ttf_name"); init(); } } private void init() { Typeface font = Typeface.createFromAsset(context.getAssets(), ttfName); setTypeface(font); } @Override public void setTypeface(Typeface tf) { super.setTypeface(tf); }
for (int i = 0; i < attrs.getAttributeCount(); i++) { String attr = attrs.getAttributeName(i); if ("name".equals(attr)) {
for(int i = 0; i < attrs.getAttributeCount(); i ++ )
System.out.println( "\n" + elem.getName() + " : " + as.getAttributeCount() );
+ "', name: '" + element.getName() + "', children: " + element.getElementCount() + ", attributes: " + attrSet.getAttributeCount() + ", leaf: " + element.isLeaf()); Enumeration attrNames = attrSet.getAttributeNames();
final ArrayList<AttributeSet> muxList = new ArrayList<AttributeSet>(); if ( htmlAttr.getAttributeCount() != 0 ) { muxList.add( htmlAttr );
+ "', name: '" + element.getName() + "', children: " + element.getElementCount() + ", attributes: " + attrSet.getAttributeCount() + ", leaf: " + element.isLeaf()); Enumeration attrNames = attrSet.getAttributeNames();