ANDROID APP
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
}<br />
การสร้างวิวขึ้นเอง (Android Custom View)<br />
281<br />
}<br />
return result;<br />
private int measureHeight(int measureSpec) {<br />
int result = 0;<br />
int specMode = MeasureSpec.getMode(measureSpec);<br />
int specSize = MeasureSpec.getSize(measureSpec);<br />
}<br />
mAscent = (int) mTextPaint.ascent();<br />
if (specMode == MeasureSpec.EXACTLY) {<br />
// We were told how big to be<br />
result = specSize;<br />
} else {<br />
// Measure the text (beware: ascent is a negative number)<br />
result = (int) (-mAscent + mTextPaint.descent())<br />
+ getPaddingTop() + getPaddingBottom();<br />
if (specMode == MeasureSpec.AT_MOST) {<br />
Log.v("Messure Height", "At most Height:"+specSize);<br />
result = Math.min(result, specSize);<br />
}<br />
}<br />
return result;<br />
private void drawArcs(Canvas canvas, RectF oval, boolean useCenter,<br />
Paint paint) {<br />
canvas.drawArc(oval, mStart, mSweep, useCenter, paint);<br />
}<br />
@Override protected void onDraw(Canvas canvas) {<br />
mMatrix.setRotate(mRotate, this.getMeasuredWidth()/2,<br />
this.getMeasuredHeight()/2);<br />
mShader.setLocalMatrix(mMatrix);<br />
mRotate += 3;<br />
if (mRotate >= 360) {<br />
mRotate = 0;<br />
}<br />
RectF drawRect = new RectF();<br />
drawRect.set(this.getWidth()-mTextPaint.measureText(mText),<br />
(this.getHeight()-mTextPaint.getTextSize())/2,