Android的龙preSS微调查看 [英] Android Long Press Spinner View
本文介绍了Android的龙preSS微调查看的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我希望能够在微调鉴于长preSS项目,并有一个文本菜单出现。我想这code:
I want to be able to long press items in the spinner view and have a contextMenu appear. I tried this code:
spinner = (Spinner) findViewById(R.id.catagorySpinner);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(context,android.R.layout.simple_dropdown_item_1line, data);
spinner.setAdapter(adapter);
registerForContextMenu(spinner);
但你可以猜测这增加了上下文菜单的实际微调,而不是里面的内容。有谁知道我可以做到这一点?
but as you can guess this added a context menu to the actual Spinner and not to the contents inside. Does anyone know how i can do this?
推荐答案
您是否尝试过这个?
spinner.setOnItemLongClickListener(new OnItemLongClickListener() {
public boolean onItemLongClick(AdapterView<?> parent, View view, int arg2, long arg3) {
view.showContextMenu();
return true;
}
});
这篇关于Android的龙preSS微调查看的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文