0

I want to add a caption into a wheel picker. Like this:

Caption of Wheel Picker

But in my code, it shows in all of the items in the wheel. Here is my code:

 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));
 minute.setViewAdapter(new NumericWheelAdapter(context, 1, 23,"%02d hour"));        
 minute.setCurrentItem(0);
 minute.addChangingListener(listener);

I want to show the caption only in the current line.

Paul Roub
  • 36,322
  • 27
  • 84
  • 93
Chann Lynn
  • 201
  • 1
  • 3
  • 14

1 Answers1

0

You can try it:

 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);
                }
            });
Ravind Maurya
  • 977
  • 15
  • 24