我有一个嵌入水平滚动条内的cutom视图。我注意到我的ondraw方法一直被调用。是因为水平滚动条吗?
这是我的提取功能: -
@Override
public void onDraw(Canvas canvas) {
Log.w(this.getClass().getName(),"onDraw of Balls called");
BallsOnDraw(canvas);
}
void BallsOnDraw(Canvas canvas)
{
canvas.drawLine(0, 240, 160, 0, mPaint);
canvas.drawLine(160, 0, 320, 240, mPaint);
TranslateAnimation mTrans = new TranslateAnimation(0, 320, 0,240);
mTrans.setDuration(6000);
SitoliaActivity.mBal.startAnimation(mTrans);
}
答案 0 :(得分:0)
Android系统总是调用onDraw()这是正常的,因为它是在画布上绘制视图的方法http://developer.android.com/reference/android/view/View.html#onDraw(android.graphics.Canvas)