//繪圖
publicclass MyView extends View
{
//圖片宣告
private Bitmap m_bmpMain = null;
//畫筆宣告
public Paint m_paint = new Paint();
@Override
protectedvoid onDraw(Canvas canvas)
{
// TODO Auto-generated method stub
super.onDraw(canvas);
canvas.drawColor(Color.WHITE);
m_paint.setColor(Color.RED); //畫筆顏色
m_paint.setStrokeWidth(5.0f);//設定粗細
for(int ii=0;ii<4;ii++)
{
//畫線
canvas.drawLine(10.0f, (ii+1)*100.0f, 300.0f, (ii+1)*100.0f, m_paint);
}
m_paint.setColor(Color.BLUE);
m_paint.setStrokeWidth(3);
for(int ii=0;ii<4;ii++)
{
canvas.drawLine( (ii+1)*100.0f, 100.0f, (ii+1)*100.0f, 400.0f, m_paint);
}
//畫圈圈
canvas.drawCircle(m_fCirciePosX, m_fCirciePosY, m_fCircieR, m_paint);
m_paint.setColor(Color.WHITE);
canvas.drawCircle(m_fCirciePosX, m_fCirciePosY, 10, m_paint);
//畫圖片
Matrix l_matrix = new Matrix();
l_matrix.setTranslate(m_fIconPosX - m_bmpIcon.getWidth()/2, m_fIconPosY - m_bmpIcon.getHeight()/2);
canvas.drawBitmap(m_bmpIcon, l_matrix, m_paint);
//載入圖片
m_bmpMain = BitmapFactory.decodeResource( e_res, R.drawable.icon );
//背景設定
e_canvas.drawColor(Color.YELLOW);
}
}
privatelongm_nLastUpdateTime = System.currentTimeMillis(); //取得時間
留言列表