【发布时间】:2015-10-17 11:08:11
【问题描述】:
我用过以下:
public class CategoryFragment extends Fragment implements SwipeListViewCallback {
private ListView category_linear;
//code...
category_linear.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
Intent ii = new Intent(context, otherscreen.class);
startActivity(ii);
}
});
我也有 SwipeListViewCallback 的方法:
@Override
public void onItemClickListener(ListAdapter adapter, int position) {
// TODO Auto-generated method stub
}
当我在列表视图项目上单击一次时,它不会打开其他活动。
当点击两次然后它就可以工作了。
我想一键打开列表视图项上的其他活动
【问题讨论】:
-
为什么你同时使用 Listener ?只需使用
category_linear.setOnItemClickListener(this);并在onItemClickListener方法中移动开始下一个活动相关代码 -
@ρяσѕρєяK 当我删除了 swipelistviewcallback 的监听器时,它显示错误
Add unimplemented methods -
请重新阅读我的评论,我说的是替换您在
setOnItemClickListener中传递的匿名侦听器this -
当我写这个
-category_linear.setOnItemClickListener(this);然后它显示错误The method setOnItemClickListener(AdapterView.OnItemClickListener) in the type AdapterView<ListAdapter> is not applicable for the arguments (CategoryFragment)
标签: android android-fragments android-intent android-listview swipe