subList是一个自定义视图适配器,代码如下所示。为什么它不起作用?
代码:
TimeTableSubjectAdapter subList = new TimeTableSubjectAdapter(this,words);
ListView drawList = (ListView)findViewById(R.id.SubjectsDragList);
drawList.setAdapter(subList);
drawList.setClickable(true);
drawList.setLongClickable(true);
drawList.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View view) {
Log.e("TextView:","Picked up");
ClipData data = ClipData.newPlainText("","");
View.DragShadowBuilder shadowBuilder = new View.DragShadowBuilder(view);
view.startDrag(data,shadowBuilder,view,0);
return false;
}
});
答案 0 :(得分:0)
我认为你需要处理项目点击,而不是ListView
一般
drawList.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> adapterView, View view, int i, long l) {
...
}
});