<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
<com.android.test.TestView
android:id="@+id/testview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>
</FrameLayout>
package com.android.test;
import android.app.Activity;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.Typeface;
import android.os.Bundle;
import android.view.View;
public class TestActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(new TestView(this));
}
public class TestView extends View {
private Paint mPaint = new Paint();
public TestView(Context context) {
super(context);
}
@Override
protected void onDraw(Canvas canvas) {
// TODO Auto-generated method stub
super.onDraw(canvas);
String text = "Android - 机器人";
mPaint.setColor(Color.WHITE);
Paint paint = new Paint();
paint.setColor(Color.RED);
String familyName = "宋体";
Typeface font = Typeface.create(familyName,Typeface.BOLD);
paint.setTypeface(font);
paint.setTextSize(22);
canvas.drawRect(new Rect(0, 0, 320, 240), mPaint);
canvas.drawText(text, 0, 100, paint);
}
}
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有