Hello i have a app which makes 3 wheels from 3 different arrays of words i am trying to make the text size of the words in the array smaller can someone point me in the right direction.
I have tried the textsize in my xml but it dosent seem to work so is there a way around this in the java?
Thanks.
public class PasswActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.passw_layout);
initWheel(R.id.passw_1, new String[] { "One", "Two", "Three" });
initWheel(R.id.passw_2, new String[] { "Four", "Five", "Six" });
initWheel(R.id.passw_3, new String[] { "Seven", "Eight", "Nine" });
Button mix = (Button) findViewById(R.id.btn_mix);
mix.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
mixWheel(R.id.passw_1);
mixWheel(R.id.passw_2);
mixWheel(R.id.passw_3);
}
});
}
private boolean wheelScrolled = false;
OnWheelScrollListener scrolledListener = new OnWheelScrollListener() {
public void onScrollingStarted(WheelView wheel) {
wheelScrolled = true;
}
public void onScrollingFinished(WheelView wheel) {
wheelScrolled = false;
}
};
private OnWheelChangedListener changedListener = new OnWheelChangedListener() {
public void onChanged(WheelView wheel, int oldValue, int newValue) {
if (!wheelScrolled) {
}
}
};
private void initWheel(int id, String[] values) {
WheelView wheel = getWheel(id);
wheel.setViewAdapter(new ArrayWheelAdapter<String>(this, values));
wheel.setCurrentItem((int) (Math.random() * 10));
wheel.addChangingListener(changedListener);
wheel.addScrollingListener(scrolledListener);
wheel.setCyclic(true);
wheel.setInterpolator(new AnticipateOvershootInterpolator());
}
private WheelView getWheel(int id) {
return (WheelView) findViewById(id);
}
private boolean testPin(int v1, int v2, int v3, int v4) {
return testWheelValue(R.id.passw_1, v1)
&& testWheelValue(R.id.passw_2, v2)
&& testWheelValue(R.id.passw_3, v3);
}
private boolean testWheelValue(int id, int value) {
return getWheel(id).getCurrentItem() == value;
}
private void mixWheel(int id) {
WheelView wheel = getWheel(id);
wheel.scroll(-25 + (int) (Math.random() * 50), 2000);
}
}
Assume you are using KanKan Wheel. Actually the textSize is set through wheelAdapter, not wheelView. I know this is weird, but let's face the facts.
You need use kankan.wheel.widget.adapters.AbstractWheelTextAdapter, extend a subclass, and set textSize after you initialize your wheelAdapter and before set it to wheelView:
private class MyWheelAdapter extends AbstractWheelTextAdapter {
... ...
}
myWheelAdapter = new MyWheelAdapter(getApplicationContext());
myWheelAdapter.addAll(myWheelList);
myWheelAdapter.setTextSize(18);
// initialise wheel widget
myWheelView = (WheelView) findViewById(R.id.my_wheel_view);
myWheelView.setViewAdapter(myWheelAdapter);
Hope that help.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With