我可以为Wheel picker添加标题吗?

时间:2014-01-13 09:56:33

标签: java android android-wheel

我想为车轮选择器添加一个标题。我找不到任何标题的方法。我已经有一个只用java编写的车轮选择器。我想只在java中添加标题。请帮助我。

编辑:这是我的代码。

    final WheelView minute = new WheelView(Mcontex);
    minute.setMinimumHeight(300);
    layoutHome.addView(minute, new LayoutParams(
            android.view.ViewGroup.LayoutParams.WRAP_CONTENT,
            android.view.ViewGroup.LayoutParams.WRAP_CONTENT, 1.2f));
    layoutmain.addView(layoutHome);
    minute.setViewAdapter(new RotationArrayAdapter(context, minutesArray, 1));
    minute.setCurrentItem(0);
    minute.addChangingListener(listener);

1 个答案:

答案 0 :(得分:0)

你可以尝试一下:

 String[] dayArray = {"2 JAN", "3 jan", "4 jan", "5 jan", "6 jan", "7 jan", "8 jan"};
    WheelView  day;

    day = (WheelView) findViewById(R.id.day);
            day.setViewAdapter(new DayArrayAdapter(MainActivity.this, dayArray, weekDay));


            day.addChangingListener(new OnWheelChangedListener() {

                @Override
                public void onChanged(WheelView wheel, int oldValue, int newValue) {

                    Log.e("onChanged hours", dayArray[newValue]);

                    mCustomDate = dayArray[newValue];
                    mFinalTime = mCustomDate+" "+mCustomHour+mCustomMinute+" "+mAMORPM;
                    mSeletedDateTextView.setText(mFinalTime);
                }
            });