Code example for Paint

Methods: descent, getTextSize

0
	protected void onDraw(Canvas canvas)
	{ 
		super.onDraw(canvas);
 
		int x = 0, page = 0;
		int y = (int) (getHeight() + _pntText.getTextSize() - _pntText.descent()) / 2;
		int count = _cands.size();
		_divider.setBounds(0, 0, _divider.getIntrinsicWidth(), getHeight());
		 
		for(int i=0;i<count;i++)
		{ 
			CharSequence cand = _cands.get(i);
			float textWidth = _pntText.measureText(cand.toString());
			float cellWidth = textWidth + 2;
			if (cellWidth < _wordWidth)
				cellWidth = _wordWidth;
			_candIdxToWidth[i] = (int)textWidth;
			_candIdxToX[i] = x;
			_candIdxToPage[i] = page;
 
			// FIXME: Failed if single candidate's textWidth > getWidth()