3.JPG

XML 레이아웃 으로 해봤는데 에러가나서 뭐가 잘못인지 한번 봐주세여~

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="#666666"
    >

    <test.view.Cdisplay android:id="@+id/myTView"
    android:layout_width="fill_parent"
    android:layout_height="430px"
    android:background="#000000"

  
    />
    <EditText android:id="@+id/input"
    android:layout_width="80px"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_alignParentLeft="true"
    android:text=""
    />
</RelativeLayout>


package test.view;

import android.app.Activity;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;

public class Tview extends Activity {
    /** Called when the activity is first created. */
  private Cdisplay bioView;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //Cdisplay displayview = new Cdisplay(this);
        //setContentView(displayview);
        setContentView(R.layout.main);
    }
    public class Cdisplay extends View{

  private int mAlpha;
  private float mX;
  private float mY;

  public Cdisplay(Context context) {
   super(context);
   mAlpha=100;
   mX=160;
   mY=200;
   // TODO Auto-generated constructor stub
  }

  @Override
  protected void onDraw(Canvas canvas) {
   // TODO Auto-generated method stub
   
   Paint paint;
   paint = new Paint();
   paint.setARGB(mAlpha, 255, 0, 0);
   canvas.drawCircle(mX, mY, 77, paint);
   super.onDraw(canvas);
  }

  @Override
  public boolean onTouchEvent(MotionEvent event) {
   // TODO Auto-generated method stub
   mX=event.getX();
   mY=event.getY();
   mAlpha = mAlpha +10;
   if(mAlpha > 256) mAlpha =0;
   invalidate();
   return super.onTouchEvent(event);
   
   
   
  }
     
    }
}