Dav*_*own 3 android click button
我听说过我们可以通过在Android中暂存一下来创建Button的click事件.
我想在我的应用程序中使用该功能.
谁能告诉我怎么做?
谢谢,大卫
看看View.OnLongClickListener.
public class MyActivity extends Activity {
protected void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.content_layout_id);
final Button button = (Button) findViewById(R.id.button_id);
button.setOnLongClickListener(new View.OnLongClickListener() {
public boolean onLongClick(View v) {
// Perform action on click
return true;
}
});
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4449 次 |
| 最近记录: |