标签:
首先需要implements
1 public class MainActivity extends AppCompatActivity implements OnItemLongClickListener
再绑定
1 ListView listView = (ListView)findViewById(R.id.list_view); 2 listView.setOnItemLongClickListener(this);
再override
1 @Override 2 public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) { 3 Log.e("onItemLongClick",""+id); 4 return true;//这个boolean值为true则click被拦截,false则click同样响应 5 }
标签:
原文地址:http://www.cnblogs.com/turtle920/p/4870085.html