Code example for Rect

Methods: heightwidth

0
 
	@Override 
	protected void onBoundsChange( Rect bounds ) {
		super.onBoundsChange( bounds );
 
		mWidth = bounds.width();
		mHeight = bounds.height();
		 
		onTextBoundsChanged(); 
	} 
	 
	private int mTextY = 0;
	 
	protected final void onTextBoundsChanged() { 
		mTextSize = mWidth / 2.0f;
		mTextPaint.setTextSize( mTextSize );
		mTextPaint.getTextBounds( mLabel, 0, mLabel.length(), mBounds );
		mTextPaint.getFontMetrics( mMetrics );
		 
		mTextY = (int) ( ( ( mWidth / 2.0f ) + mTextSize/2.0f ) - mMetrics.bottom/2.0f );