Tampilkan postingan dengan label 文字列. Tampilkan semua postingan
Tampilkan postingan dengan label 文字列. Tampilkan semua postingan

Sabtu, 04 Desember 2010

Viewで文字列を描画

 // Viewを継承したクラスのメソッド
@Override
public void onDraw(Canvas canvas) {
    super.onDraw(canvas);
    Paint rubyPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    Paint textPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    rubyPaint.setTextSize(12.0f);
    textPaint.setTextSize(24.0f);
    rubyPaint.setColor(Color.WHITE);
    textPaint.setColor(Color.WHITE);
    String ruby = "シリアライズ";
    String text = "serialize";
    float rubyX = (textPaint.measureText(text) - rubyPaint.measureText(ruby)) / 2;
    float textX = 0.0f;
    float rubyY = 32.0f;
    float textY = rubyY + textPaint.getTextSize();
    canvas.drawText(ruby, rubyX, rubyY, rubyPaint);
    canvas.drawText(text, textX, textY, textPaint);
    canvas.drawColor(Color.TRANSPARENT);
}
 
Copyright 2010 hot news. All rights reserved.
Themes by Ex Templates Blogger Templates l Home Recordings l Studio Rekaman Sitemap New gadget news Luxury Car Review Celebrity News Head Line News News Trends Concept cars Gambar Mesin Circuit Electronic Celebrity News Trends MotoGP News Trends Ghost Mistery Honda Modify Ghost photo Collection Credit Card Mstered Flower Colelction Photo Hybrid Auto News Modification Auto Indonesian News Trends Day News Trends Automotive News Trends vex robotic kit Hot News Trends