Last active
December 19, 2015 00:29
-
-
Save julianshen/5869376 to your computer and use it in GitHub Desktop.
init of SimpleCellLayout
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public SimpleCellLayout(Context context, AttributeSet attrs) { | |
super(context, attrs); | |
initFromAttributes(context, attrs); | |
} | |
public SimpleCellLayout(Context context, AttributeSet attrs, int defStyle) { | |
super(context, attrs, defStyle); | |
initFromAttributes(context, attrs); | |
} | |
private void initFromAttributes(Context context, AttributeSet attrs) { | |
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.SimpleCellLayout); | |
for (int i = 0; i < a.getIndexCount(); i++) { | |
int attr = a.getIndex(i); | |
switch (attr) { | |
case R.styleable.SimpleCellLayout_col: | |
mColCount = a.getInt(attr, mColCount); | |
break; | |
case R.styleable.SimpleCellLayout_row: | |
mRowCount = a.getInt(attr, mRowCount); | |
break; | |
case R.styleable.SimpleCellLayout_gapsize: | |
mGap = a.getDimensionPixelSize(attr, mGap); | |
break; | |
} | |
} | |
a.recycle(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment