カスタムビューのテキストにポップアップ&ゴーバック効果をつけたい。Text Size とPostInvalidate();
. ただし、Custom View では効果がありません。
カスタム ビュー OnDraw メソッド:
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
canvas.drawText(carMessage, getPercentOfWidth(40),getPercentOfHeight(20),fontPaint);
canvas.drawBitmap(carSpriteImage, carspritePosition.x , carspritePosition.y, null);
}
フォント アップデータ スレッド クラス コード:
@Override
public void run() {
super.run();
while(true){
paint.setTextSize(minSize);
Log.i("Font Thread!", "Min Font Size="+minSize);
customeView.setCarMessage("Click Me");
customeView.setFontPaint(paint);
customeView.postInvalidate();
try {
Thread.sleep(700);
} catch (InterruptedException e) {
e.printStackTrace();
}
paint.setTextSize(maxSize);
customeView.setCarMessage("To Stop");
customeView.setFontPaint(paint);
Log.i("Font Thread!", "Max Font Size="+maxSize);
customeView.postInvalidate();
}
}