import android.os.bundle;
import android.view.keyevent;
import android.view.motionevent;
import android.view.view;
import android.view.view.onclicklistener;
import android.view.view.onfocuschangelistener;
import android.view.view.onkeylistener;
import android.view.view.onlongclicklistener;
import android.view.view.ontouchlistener;
import android.widget.button;
import android.widget.textview;
public class mainactivity extends activity
onclicklistener click = new onclicklistener()
}; ontouchlistener ontouch = new ontouchlistener() else if (event.getaction() == motionevent.action_move) else if (event.getaction() == motionevent.action_up)
return true;// 返回true,焦點不繼續傳遞,其餘焦點事件無效(如click longclick)
// 返回false則繼續傳遞
} };
onlongclicklistener onlong = new onlongclicklistener()
}; /**
* 焦點事件監聽,主要監聽獲得和失去焦點事件
*/onfocuschangelistener focuschange = new onfocuschangelistener() else
} };
/*** 遙控器按鍵監聽
*/onkeylistener onkey = new onkeylistener() else if (keycode == keyevent.keycode_dpad_right) else if (keycode == keyevent.keycode_dpad_down) else if (keycode == keyevent.keycode_dpad_up) else if (keycode == keyevent.keycode_dpad_center || keycode == keyevent.keycode_enter) else if (keycode == keyevent.keycode_menu)
return true;
} };
}
Android view事件分發總結
事件分發的關係偽 public boolean dispatchtouchevent motionevent ev else return consume 1 一般情況是不對dispatchtouchevent 進行改寫的,通常是改寫onintercepttouchevent ontoucheven...
UIImageview 點選事件
uiimageview imageview uiimageview alloc initwithframe cgrectmake 100,100,200,200 imageview.image uiimage imagenamed filter laozhaopian a.png imageview...
onclick 點選事件
1.開啟 name button1 2.另存為 name button2 3.屬性 name button3 4.列印 name button 5.頁面設定 name button4 6.重新整理 name refresh 7.匯入收藏夾 name button5 8.匯出收藏夾 name butt...