Android AttributeSet - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android AttributeSet class.

This code example shows how to use the following methods:getAttributeIntValue, getAttributeValue
This code example shows how to use the following methods:getAttributeIntValue, getAttributeValue
		//mSeekBar.setMax(mMaxValue - mMinValue); 
		//mSeekBar.setOnSeekBarChangeListener(this);	 
		} 
 
	private void setValuesFromXml(AttributeSet attrs) {
		mMaxValue = attrs.getAttributeIntValue(ANDROIDNS, "max", 100);
		mMinValue = attrs.getAttributeIntValue(ROBOBUNNYNS, "min", 0);
 
		mUnitsLeft = getAttributeStringValue(attrs, ROBOBUNNYNS, "unitsLeft",
				""); 
		String units = getAttributeStringValue(attrs, ROBOBUNNYNS, "units", "");
		mUnitsRight = getAttributeStringValue(attrs, ROBOBUNNYNS, "unitsRight",
				units);
		 
		mCurrentValue = attrs.getAttributeIntValue(ANDROIDNS, "summary", 100);
 
		try { 
			String newInterval = attrs.getAttributeValue(ROBOBUNNYNS,
					"interval"); 
			if (newInterval != null)

8
CodeRank
This code example shows how to use the following methods:getAttributeIntValue, getAttributeValue
This code example shows how to use the following methods:getAttributeIntValue, getAttributeValue
		mSeekBar.setMax(mMaxValue - mMinValue);
		mSeekBar.setOnSeekBarChangeListener(this);
	} 
 
	private void setValuesFromXml(AttributeSet attrs) {
		mMaxValue = attrs.getAttributeIntValue(ANDROIDNS, "max", 100);
		mMinValue = attrs.getAttributeIntValue(ROUNDRNS, "min", 0);
 
		mUnitsLeft = getAttributeStringValue(attrs, ROUNDRNS, "unitsLeft", "");
		String units = getAttributeStringValue(attrs, ROUNDRNS, "units", "");
		mUnitsRight = getAttributeStringValue(attrs, ROUNDRNS, "unitsRight", units);
 
		try { 
			String newInterval = attrs.getAttributeValue(ROUNDRNS, "interval");
			if (newInterval != null)
				mInterval = Integer.parseInt(newInterval);
		} catch (Exception e) {
			Log.e(TAG, "Invalid interval value", e);
		} 
 

7
CodeRank
This code example shows how to use the following methods:getAttributeBooleanValue, getAttributeResourceValue, getAttributeValue
		return mDefaultValue;
	} 
 
	protected void init(final Context context, final AttributeSet attrs) {
		if (attrs != null) {
			final String defaultValue = attrs.getAttributeValue(ANDROID_NS, ATTR_DEFAULTVALUE);
			if (defaultValue != null && defaultValue.startsWith("#")) {
				try { 
					setDefaultValue(Color.parseColor(defaultValue));
				} catch (final IllegalArgumentException e) {
					Log.e("ColorPickerPreference", "Wrong color: " + defaultValue);
					setDefaultValue(Color.WHITE);
				} 
			} else { 
				final int colorResourceId = attrs.getAttributeResourceValue(ANDROID_NS, ATTR_DEFAULTVALUE, 0);
				if (colorResourceId != 0) {
					setDefaultValue(context.getResources().getColor(colorResourceId));
				} 
			} 
			mAlphaSliderEnabled = attrs.getAttributeBooleanValue(null, ATTR_ALPHASLIDER, false);

7
CodeRank
This code example shows how to use the following methods:getAttributeIntValue, getAttributeValue
		mSeekBar.setMax(mMaxValue - mMinValue);
		mSeekBar.setOnSeekBarChangeListener(this);
	} 
	 
	private void setValuesFromXml(AttributeSet attrs) {
		mMaxValue = attrs.getAttributeIntValue(ANDROIDNS, "max", 100);
		mMinValue = attrs.getAttributeIntValue(ROBOBUNNYNS, "min", 0);
		 
		mUnitsLeft = getAttributeStringValue(attrs, ROBOBUNNYNS, "unitsLeft", "");
		String units = getAttributeStringValue(attrs, ROBOBUNNYNS, "units", "");
		mUnitsRight = getAttributeStringValue(attrs, ROBOBUNNYNS, "unitsRight", units);
		 
		try { 
			String newInterval = attrs.getAttributeValue(ROBOBUNNYNS, "interval");
			if(newInterval != null)
				mInterval = Integer.parseInt(newInterval);
		} 
		catch(Exception e) {
			Log.e(TAG, "Invalid interval value", e);
		} 

7
CodeRank
This code example shows how to use the following methods:getAttributeIntValue, getAttributeValue
This code example shows how to use the following methods:getAttributeIntValue, getAttributeResourceValue, getAttributeValue
This code example shows how to use the following methods:getPositionDescription
        String name = sa.getString(R.styleable.Extra_android_name);
        if (name == null) {
            sa.recycle();
            throw new XmlPullParserException("<" + tagName
                    + "> requires an holo:name attribute at " 
                    + attrs.getPositionDescription());
        } 
        TypedValue v = sa.peekValue(R.styleable.Extra_android_value);
        if (v != null) {
            if (v.type == TypedValue.TYPE_STRING) {
                CharSequence cs = v.coerceToString();
                outBundle.putCharSequence(name, cs);
            } else if (v.type == TypedValue.TYPE_INT_BOOLEAN) {
                outBundle.putBoolean(name, v.data != 0);
            } else if (v.type >= TypedValue.TYPE_FIRST_INT
                    && v.type <= TypedValue.TYPE_LAST_INT) {
                outBundle.putInt(name, v.data);
            } else if (v.type == TypedValue.TYPE_FLOAT) {
                outBundle.putFloat(name, v.getFloat());
            } else { 

7
CodeRank
This code example shows how to use the following methods:getAttributeResourceValue, getAttributeValue

Related Android AttributeSet Questions & Answers:

Other Android AttributeSet Examples

43:		}
44:	
45:		public TouchImageView(Context context, AttributeSet attrs) {
46:			super(context, attrs);
47:			sharedConstructing(context);

Read More

See Code Examples for Android AttributeSet Methods: