您的位置:首页 > 移动开发 > Android开发

Android 如何通过长按list弹出操作选项

2012-05-21 16:53 288 查看
protected void onListItemClick(int position) {
final int pos = position;
AlertDialog dlg = new AlertDialog.Builder(this).setTitle(R.string.team_change).setItems(items, new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (which == 0) {
sendMSG(pos);
} else if (which == 1) {
changeIcon(pos);
} else if (which == 2) {
if (isLeader) {
changeLeader(pos);
}
}
}
}).create();
dlg.show();
}
pos是点击弹出的列表的行号,再通过对pos的辨别分别作不做的操作,初学安卓不久,一点点的小技术使用都是一个进步,坚持下去就是胜利!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐