【发布时间】:2012-11-24 10:01:56
【问题描述】:
我有一个 Android 应用程序。在我从ListActivity 派生的一项活动中,我实现了OnItemLongClickListener。我想在 ListItem 已被 LongClicked 的相关列表项中启用删除按钮。我该怎么做?
OnItemLongClickListener listener = new OnItemLongClickListener(){
public boolean onItemLongClick(AdapterView<?> av, View v, int position, long id) {
Account a = null;
a = (Account) av.getItemAtPosition(position);
Toast.makeText(AccountActivity.this, "Long Clicked : " + a.getAccountName(), Toast.LENGTH_LONG).show();
//instead of the toast, I need to show/enable a button here...
}
};
getListView().setOnItemLongClickListener(listener);
【问题讨论】:
标签: android long-press