Esempio n. 1
0
  /** Initialize the Views and GUI widgets. */
  private void initializeViews() {
    LayoutInflater inflater =
        (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    LinearLayout view =
        (LinearLayout) inflater.inflate(R.layout.material_spinner_layout, this, true);
    containerFrameLayout = (FrameLayout) view.getChildAt(0);
    materialSpinner = (MaterialSpinner) containerFrameLayout.getChildAt(0);
    triangleShape = (TriangleShape) containerFrameLayout.getChildAt(1);
    lineView = containerFrameLayout.getChildAt(2);

    if (initializedByParsing) {
      // Spinner
      materialSpinner.setTextSize(textSize);
      materialSpinner.setTextColor(textColor);
      materialSpinner.setBackgroundColor(backgroundColor);
      materialSpinner.setVisibleItemNumber(visibleItems);
      materialSpinner.setVerticalItemsOffset(itemsOverSpinner);
      triangleShape.setColor(arrowColor);
      if (backgroundDrawable != null) materialSpinner.setBackground(backgroundDrawable);
      if (typeface != null) materialSpinner.setTypeFace(typeface);
      setArrowColor(arrowColor);
      setLineColor(lineColor);
      setMode(mode);

      // Item
      materialSpinner.setItemTextSize(itemTextSize);
      materialSpinner.setItemTextColor(itemTextColor);
      materialSpinner.setItemBackgroundColor(itemSelectedColor);
      materialSpinner.setItemBackgroundDrawable(itemSelectedDrawable);

      // List
      materialSpinner.setPopUpBackgroundColor(listBackgroundColor);
      materialSpinner.setPopupBackgroundDrawable(listBackgroundDrawable);
    }
  }
Esempio n. 2
0
 /**
  * Set arrow color
  *
  * @param color - color code
  */
 public void setArrowColor(int color) {
   triangleShape.setColor(color);
 }