导读:iphone上的大滚轮,在android上也有实现了。具体的例子在附件里

          在网上看到的,分享一个有意思的东西,iphone上的大滚轮,在android上也有实现了。具体的例子在附件里。

final AlertDialog dialog = new AlertDialog.Builder(this).create();
dialog.setTitle("选择分类");
final WheelView catalogWheel = new WheelView(this);
dialog.setButton("确定", new DialogInterface.OnClickListener() {

@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
// 实现下ui的刷新
}
});
dialog.setButton2("取消", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
catalogWheel.setVisibleItems(5);
// 设置显示的字,CATAS为种类的名字
catalogWheel.setAdapter(new ArrayWheelAdapter<String>(CATAS));
dialog.setView(catalogWheel);

        上面这段就是我在项目中具体的实现,放到了一个dialog中显示。最终实现还是出了些问题,我的手机是2.1的系统,看起来一切正常。放到了2.2的系统中,居然2个汉字挤到了一起。最后的解决也很简单,在汉字的左右各加了个空格⋯⋯
 https://files.cnblogs.com/shanzei/pickview.zip