private void initFromAttributes(Context context, AttributeSet attrs) { TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ProportionalLayout); mDirection = Direction.parse(a.getString(R.styleable.ProportionalLayout_direction)); mRatio = a.getFloat(R.styleable.ProportionalLayout_ratio, 1.0f); a.recycle(); }