Android监听长点击事件
示例
要获得长按并使用它,您需要为按钮提供适当的侦听器:
View.OnLongClickListener listener = new View.OnLongClickListener() { public boolean onLongClick(View v) { Button clickedButton = (Button) v; String buttonText = clickedButton.getText().toString(); Log.v(TAG, "button long pressed --> " + buttonText); return true; } }; button.setOnLongClickListener(listener);