嗨我必须在listview中添加一个手势,我想实现联系人应用程序的相同功能.当我离开滑动它应该发送一条消息,右键滑动它应该打电话.任何人都可以帮助我如何做这些手势检测...我已经在各种其他视图中实现了...但我不能为listView做...我不知道什么去了...我的代码是`
/** Called when the activity is first created. */
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.main);
// Create an array of Strings, that will be put to our ListActivity
String[] names = new String[] { "Linux", "Windows7", "Eclipse", "Suse", "Ubuntu", "Solaris", "Android", "iPhone"};
// Create an ArrayAdapter, that will actually make the Strings above
// appear in the ListView
this.setListAdapter(new ArrayAdapter<String>(this, R.id.MyList, names));
gestureListener = new ListView.OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
if (gestureDetector.onTouchEvent(event)) {
return …Run Code Online (Sandbox Code Playgroud)