WheelView
WheelView copied to clipboard
style not applied problem!
bellow style not working , and text still is black , and there is no difference between text size and selected text size in!!!! why? is there a problem in this code?
WheelView.WheelViewStyle style = new WheelView.WheelViewStyle();
style.backgroundColor = Color.TRANSPARENT;
style.selectedTextColor = Color.parseColor("#f1f2f2");
style.textColor = Color.parseColor("#9a9a9a");
style.holoBorderColor = Color.parseColor("#666666");
style.textSize = 16;
style.selectedTextSize = 20;
WheelView simpleWheelView = (WheelView) view.findViewById(R.id.year_wheelview);
simpleWheelView.setWheelAdapter(new ChannelWheelAdapter(getContext()));
simpleWheelView.setWheelSize(7);
simpleWheelView.setWheelData(createDatas());
simpleWheelView.setLoop(true);
simpleWheelView.setSkin(WheelView.Skin.Holo);
simpleWheelView.setStyle(style);
hello,you can see the source. in the WheelView line 222
private void addOnGlobalLayoutListener() { getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver .OnGlobalLayoutListener() { @Override public void onGlobalLayout() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { getViewTreeObserver().removeOnGlobalLayoutListener(this); } else { getViewTreeObserver().removeGlobalOnLayoutListener(this); } if (getChildCount() > 0 && mItemH == 0) { mItemH = getChildAt(0).getHeight(); if (mItemH != 0) { ViewGroup.LayoutParams params = getLayoutParams(); params.height = mItemH * mWheelSize; refreshVisibleItems(getFirstVisiblePosition(), getCurrentPosition() + mWheelSize / 2, mWheelSize / 2); setBackground(); } else { throw new WheelViewException("wheel item is error."); } } } }); }
remove that
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { getViewTreeObserver().removeOnGlobalLayoutListener(this); } else { getViewTreeObserver().removeGlobalOnLayoutListener(this); }
you need pull the source ,fix it