INNER CODE UNIT · Java
init
arcadefire/nice-spinner · library/src/main/java/org/angmarch/views/NiceSpinner.java:139
private void init(Context context, AttributeSet attrs) {
Resources resources = getResources();
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.NiceSpinner);
int defaultPadding = resources.getDimensionPixelSize(R.dimen.one_and_a_half_grid_unit);
setGravity(Gravity.CENTER_VERTICAL | Gravity.START);
setPadding(resources.getDimensionPixelSize(R.dimen.three_grid_unit), defaultPadding, defaultPadding,
defaultPadding);
setClickable(true);
backgroundSelector = typedArray.getResourceId(R.styleable.NiceSpinner_backgroundSelector, R.drawable.selector);
setBackgroundResource(backgroundSelector);
textColor = typedArray.getColor(R.styleable.NiceSpinner_textTint, getDefaultTextColor(context));
setTextColor(textColor);
popupWindow = new ListPopupWindow(context);
popupWindow.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
// The selected item is not displayed within the list, so when the selected position is equal to