private Button createSegmentedControlItem(
      Context context, String title, String style, final int itemIndex, final int count) {
    Button item = new Button(context);
    item.setText(title);
    item.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            if (getMBOnSelectedListener() != null && _selectedIndex != itemIndex) {
              getMBOnSelectedListener().onSelected(itemIndex, count);
            }
            if (getMBOnClickListener() != null) {
              _onClickListener.onClick(itemIndex, count);
            }

            setFocusedItem(itemIndex);
          }
        });

    // Let's do some styling
    if (itemIndex == 0) {
      // Style our first item
      _styleHandler.styleFirstSegmentedItem(item, style);
    } else if (itemIndex == (count - 1)) {
      // Style our last item
      _styleHandler.styleLastSegmentedItem(item, style);
    } else {
      // Style our centered items
      _styleHandler.styleCenterSegmentedItem(item, style);
    }

    return item;
  }
  public MBSegmentedControlBar(Context context, List<String> titles, String style) {
    super(context);

    _itemButtons = new ArrayList<Button>();

    _styleHandler = MBViewBuilderFactory.getInstance().getStyleHandler();
    _styleHandler.styleSegmentedControlBar(this, style);

    /*
     * Let's process our titles
     */
    processTitles(context, titles, style);
  }