프로그램/Android 2013. 3. 14. 14:05

안드로이드 엑티비티, 엑티비티가 아닌곳에 클릭 리스너 넣기

 v = new View(context) {
   @Override
   protected void onDraw(Canvas canvas) {
    super.onDraw(canvas);
    drawRect(canvas);
   }
  };


  v.setBackgroundColor(color.black);
  v.setOnTouchListener(touchListener);
  LayoutParams source = new LayoutParams(LayoutParams.FILL_PARENT,
    LayoutParams.FILL_PARENT);
  v.setX(0);
  v.setY(0);

 

 

,,,,,,,,,,,,,,,,,,,,,,,,,

 

OnTouchListener touchListener = new OnTouchListener() {
  public boolean onTouch(View v, MotionEvent event) {
   TouchMotion(event);
   return true;
  }
 };