WheelView icon indicating copy to clipboard operation
WheelView copied to clipboard

Not Working When used without xml

Open sandeep-singh-91 opened this issue 9 years ago • 3 comments

I've used this code to implement this in my project.

     WheelView wheelView = new WheelView(this);
       wheelView.setWheelItemRadius(30);
       wheelView.setWheelItemCount(10);
       wheelView.setWheelRadius(120);
      wheelView.setRepeatableAdapter(true);
      wheelView.setWheelOffsetY(60);
      wheelView.setSelectionAngle(90);
      wheelView.setWheelColor(Color.parseColor("#ff0000"));
      wheelView.setWheelItemTransformer(new SimpleItemTransformer());
      wheelView.setWheelSelectionTransformer(new FadingSelectionTransformer());
      wheelView.setLayoutParams(new            RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));

    wheelView.setWheelDrawableRotatable(false);

    wheelView.setAdapter(new WheelAdapter() {
        @Override
        public Drawable getDrawable(int position) {
            //return drawable here - the position can be seen in the gifs above

            return new TextDrawable("A" + position);
        }

        @Override
        public int getCount() {
            //return the count
            return 10;
        }
    });

      rl.addView(wheelView);`

and this is the output I've got

device-2017-04-24-140527

sandeep-singh-91 avatar Apr 25 '17 12:04 sandeep-singh-91

This is my problem too !

mostafa1368 avatar Aug 14 '17 18:08 mostafa1368

this error does not correctly execute the following code. wheelview.class if (mWheelToItemDistance == ViewGroup.LayoutParams.MATCH_PARENT) { mWheelToItemDistance = (int) (mWheelBounds.mRadius - mItemRadius - mWheelPadding); }

mostafa1368 avatar Sep 15 '17 18:09 mostafa1368

To be honest I never tried it without XML, I'd happily accept a PR if you figure this out. I can help with any questions.

LukeDeighton avatar Oct 21 '17 09:10 LukeDeighton