ANDROID实现IPHONE风格的PICKER

导读: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个汉字挤到了一起。最后的解决也很简单,在汉字的左右各加了个空格⋯⋯
 http://files.cnblogs.com/shanzei/pickview.zip

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值