我有一个可扩展的列表,但每当我将OnLongClickListener设置为一个组项时,它将不再展开。如果我评论该行:
setOnLongClickListener(new OnLongClickListener() { ... });
列表将在点击时展开。附加长时间点击监听器后,它会停止扩展......
这是使用从BaseExpanableListAdapter实现的默认方法..
public View getGroupView(int groupPosition, boolean isExpanded,
View convertView, ViewGroup parent) {
if (convertView == null) {
LayoutInflater infalInflater = (LayoutInflater) this._context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = infalInflater.inflate(R.layout.parent_item, null);
}
// Set on long click listener to open navigation.
// If I comment the code below, the group items expand on click.
convertView.setOnLongClickListener(new OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
// Create new intent.
Intent mapActivityIntent = new Intent(_context, MapActivity.class);
_context.startActivity(mapActivityIntent);
return false;
}
});
}
感谢您的帮助