code: private float measureStringWidth(String text) {
          Paint mPaint = new Paint();
          mPaint.setTextSize(baselineDropDownViewFontSize * bootstrapSize);
          return (float) (DimenUtils.dpToPixels(mPaint.measureText(text)));
      }
docs: Calculating string width
  
  @param text String to calculate
  @return width of String in pixels