So here are some general instructions.
import java.io.IOException;
import java.lang.String;
import org.microbridge.server.AbstractServerListener;
import org.microbridge.server.Server;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Bitmap;
import android.graphics.Rect;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.BitmapFactory;
import android.graphics.Paint.Style;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import java.lang.String;
import org.microbridge.server.AbstractServerListener;
import org.microbridge.server.Server;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Bitmap;
import android.graphics.Rect;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.BitmapFactory;
import android.graphics.Paint.Style;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
public class Menu extends View implements OnTouchListener
{
{
....
public Bitmap bitmapMenu;
private Paint borderPaint = new Paint();
.....
.....
public Menu(Context context, Server server)
{
{
....
//fetch bitmap
bitmapMenu = BitmapFactory.decodeResource(context.getResources(),R.drawable.android);
bitmapMenu = BitmapFactory.decodeResource(context.getResources(),R.drawable.android);
...
@Override
public void onDraw(Canvas canvas) //Canvas canvas
{
// Draw background
canvas.drawRect(this.getLeft(), this.getTop(), this.getRight(), this.getBottom(), borderPaint);
//canvas.drawBitmap(bitmapMenu, 0 , 0, textPaint);
Rect src=new Rect(0,0,960,600);
Rect dst=new Rect(0,0,730,370);
canvas.drawBitmap(bitmapMenu, src, dst, textPaint);
canvas.drawText("Menu", 37 , 65, textPaint3);
}
public void onDraw(Canvas canvas) //Canvas canvas
{
// Draw background
canvas.drawRect(this.getLeft(), this.getTop(), this.getRight(), this.getBottom(), borderPaint);
//canvas.drawBitmap(bitmapMenu, 0 , 0, textPaint);
Rect src=new Rect(0,0,960,600);
Rect dst=new Rect(0,0,730,370);
canvas.drawBitmap(bitmapMenu, src, dst, textPaint);
canvas.drawText("Menu", 37 , 65, textPaint3);
}
....
....
No comments:
Post a Comment