android实现iphone风格的picker
分享一个有意思的东西,iphone上的大滚轮,在android上也有实现了。具体的例子在附件里。
final AlertDialog dialog = new AlertDialog.Builder(this).create();dialog.setTitle("选择分类");final WheelView catalogWheel = new WheelView(this);dialog.setButton("确定", new DialogInterface.OnClickListener() {@Overridepublic void onClick(DialogInterface dialog, int which) {dialog.dismiss();// 实现下ui的刷新}});dialog.setButton2("取消", new DialogInterface.OnClickListener() {@Overridepublic void onClick(DialogInterface dialog, int which) {dialog.dismiss();}});catalogWheel.setVisibleItems(5); // 设置显示的字,CATAS为种类的名字catalogWheel.setAdapter(new ArrayWheelAdapter<String>(CATAS));dialog.setView(catalogWheel);