如果你的ListView的Item有滑动功能,但又点击Item跳转到其它activity,这样若是在Adapter里面写点击事件是会导致滑动事件获取不到焦点而失效;

解决方法:不要在adapter里面写点击事件,直接添加一下

1 ListView.setOnItemClickListener(new OnItemClickListener() {
2          
3                     public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
4                             long arg3) {
5                         //进入其它activity界面
6                         startActivity(new Intent(this,activity.class));
Toast.makeText(mParent, "点击第"+arg2+"个项目", Toast.LENGTH_SHORT).show();
7 } 8 });

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-08-13
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-06-26
  • 2022-12-23
  • 2022-12-23
  • 2021-12-16
  • 2022-12-23
相关资源
相似解决方案