Skip to content

Instantly share code, notes, and snippets.

@cuber5566
Created December 29, 2014 17:41
Show Gist options
  • Save cuber5566/f28f37ba18e9f876dbcd to your computer and use it in GitHub Desktop.
Save cuber5566/f28f37ba18e9f876dbcd to your computer and use it in GitHub Desktop.
package com.cuber.uidemo;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.Typeface;
import android.util.AttributeSet;
import android.view.View;
/**
* Created by Cuber on 2014/12/21.
*/
public class CuberView extends View {
private Paint mPaint;
public CuberView(Context context, AttributeSet attrs) {
super(context, attrs);
mPaint = new Paint();
mPaint.setStrokeWidth(2);
mPaint.setStyle(Paint.Style.STROKE);
mPaint.setTextSize(600);
mPaint.setTypeface(Typeface.createFromAsset(context.getAssets(), "fonts/wt071.ttf"));
}
@Override
protected void onDraw(Canvas canvas) {
Rect rect = canvas.getClipBounds();
canvas.drawText("風",200, 500, mPaint);
super.onDraw(canvas);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment