WheelView
WheelView copied to clipboard
Not Working When used without xml
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

This is my problem too !
this error does not correctly execute the following code. wheelview.class if (mWheelToItemDistance == ViewGroup.LayoutParams.MATCH_PARENT) { mWheelToItemDistance = (int) (mWheelBounds.mRadius - mItemRadius - mWheelPadding); }
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.