2010-12-18 140 views

回答

5

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; 
     } 
    }); 
    } 
}