반응형
package test.test;

import android.content.*;
import android.content.res.*;
import android.graphics.*;
import android.view.*;

public class mainA extends View {
   
    private static Bitmap mainimg;
   
    private static Bitmap newg;
    private static Bitmap cont;
    private static Bitmap lan;
    private static Bitmap qit;
   
   
    public mainA(Context context) {
        super(context);
        setBackgroundColor(Color.WHITE);
       
        Resources r= context.getResources();
        //image =BitmapFactory.decodeResource(r,R.drawable.a);
       
        mainimg =BitmapFactory.decodeResource(r,R.drawable.mainimgpng);
       
        newg =BitmapFactory.decodeResource(r,R.drawable.newgame);
        cont =BitmapFactory.decodeResource(r,R.drawable.cont);
        lan =BitmapFactory.decodeResource(r,R.drawable.lan);
        qit =BitmapFactory.decodeResource(r,R.drawable.quit);
       
       
       
       
       
       
        // TODO Auto-generated constructor stub
    }

   
    Paint p=new Paint();
   
   
    protected void onDraw(Canvas canvas) {
        int w= mainimg.getWidth();
        int h=mainimg.getHeight();
   
       
        Rect src =new Rect(0,0,w,h);
        Rect dst =new Rect(0,0,getWidth(),getHeight());
       
               
        canvas.drawBitmap(mainimg, src,dst, null);
       
        ///////////////////
       
    /*    int newgw= newg.getWidth();
        int newgh=newg.getHeight();
        Rect newgsrc =new Rect(0,0,w,h);
        Rect newgdst =new Rect(0,0,getWidth(),getHeight());*/
        /*Rect gnesrc =new Rect(0,0,0,0);
        Rect gnewdst =new Rect(0,0,0,0);*/
        //canvas.drawBitmap(newg, gnesrc,gnewdst, null);
        /*       
         *
         */
        int statgw=(getWidth()/2)+(getWidth()/5);
       
        int statgh=(getHeight()/2)-(getHeight()/2);
        canvas.drawBitmap(newg,statgw,statgh, null);
        canvas.drawBitmap(cont,statgw,statgh+60, null);
        canvas.drawBitmap(lan,statgw,statgh+120, null);
        canvas.drawBitmap(qit,statgw,statgh+180, null);
       
       
       
        // TODO Auto-generated method stub
        super.onDraw(canvas);
    }

}




반응형

+ Recent posts