private void initTag(T dataItem) {
   if (null != tagsLayout) {
     LinearLayout.LayoutParams params =
         new LinearLayout.LayoutParams(
             width / (getItemCount() == 0 ? 1 : getItemCount()), LayoutParams.MATCH_PARENT);
     params.topMargin = DisplayUtil.dip2px(this.getContext(), 5);
     params.bottomMargin = DisplayUtil.dip2px(this.getContext(), 5);
     V view = getTag(dataItem);
     view.setLayoutParams(params);
     tagsLayout.addView(view);
     tags.add(view);
   }
 }
  private void initFocus() {
    if (null == focusView) {
      LayoutParams params =
          new LayoutParams(
              width / (getItemCount() == 0 ? 1 : getItemCount()), LayoutParams.MATCH_PARENT);
      params.topMargin = DisplayUtil.dip2px(this.getContext(), 2);
      params.bottomMargin = DisplayUtil.dip2px(this.getContext(), 2);
      focusView = initFocusUI();
      focusView.setLayoutParams(params);
      focusView.setBackgroundResource(focusBg);
      focusView.setVisibility(View.INVISIBLE);
      this.addView(focusView, layer);
    } else {
      focusView.getLayoutParams().width = width / (getItemCount() == 0 ? 1 : getItemCount());
    }

    focusView.setVisibility(tags.size() > 0 ? View.VISIBLE : View.GONE);
  }
 protected void configureTextView(TextView view) {
   textLP = new LayoutParams(LayoutParams.MATCH_PARENT, DisplayUtil.dip2px(context, 50));
   view.setTextColor(textColor);
   view.setGravity(Gravity.CENTER);
   view.setTextSize(textSize);
   view.setLines(1);
   view.setTypeface(Typeface.SANS_SERIF, Typeface.NORMAL);
   view.setLayoutParams(textLP);
   view.getHeight();
 }
  private void init(AttributeSet attrs) {
    if (null != attrs) {
      TypedArray a = this.getContext().obtainStyledAttributes(attrs, R.styleable.StoreTabBar);
      focusWidth = a.getInt(R.styleable.StoreTabBar_focusWidth, 80);
      focusWidth = DisplayUtil.dip2px(this.getContext(), focusWidth);
      colorFocusedText =
          a.getColor(
              R.styleable.StoreTabBar_focusWidth,
              this.getContext().getResources().getColor(R.color.store_tab_bar_focus_text));
      colorUnfocusedText =
          a.getColor(
              R.styleable.StoreTabBar_focusWidth,
              this.getContext().getResources().getColor(R.color.store_tab_bar_unfocus_text));
      focusBg =
          a.getResourceId(
              R.styleable.StoreTabBar_focusedResource, R.drawable.store_indicator_mask_bg);
      textSize = a.getDimension(R.styleable.StoreTabBar_textSize, 14);
      layer = a.getInt(R.styleable.StoreTabBar_layer, 0);
      a.recycle();
    }

    tags = new ArrayList<>();
    tagsData = new ArrayList<>();
  }