0

您好我已經在我的服務類中實現了ontouchlistener,並試圖獲得與android 2.3一起工作良好的觸摸事件,但它不適用於更高版本。我想了很多解決這一點,但我甚至看過很多計算器中的文件後,我沒有得到任何的解決方案,下面是代碼..please幫我解決onCreate方法這個問題onTouchListener不能在4.0以上版本的Android中工作,但它工作在

我已經定義圖像按鈕

ImageButton imageButton=new ImageButton(this); 
imageButton.setBackgroundColor(Color.TRANSPARENT); 
imageButton.setOnTouchListener(this); 

    @Override public boolean onTouch(View arg0, MotionEvent arg1) { 
Toast.makeText(getApplicationContext(), "Double touched "+DoubleTouch, 1000).show(); 
return false; 
} 
+0

沒有Android版本2.6 – WarrenFaith

+0

還有的是Android 2.6 – Pragnani

+0

好,謝謝沒有官方版本,PLZ建議對解決上述問題 –

回答

0

你想使用代碼imageButton.setOnTouchListener(youActivityname.this);

+0

嗨@saravanan感謝你的好意,我也實現了這個,但它不工作,實際上我已經在一個服務類中實現了onTouchListener –

相關問題