It works well when I try to Change text size in (EditText) by putting a constant value in code <<<<
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
EditText Text = (EditText)findViewById(R.id.editText);
SeekBar f = (SeekBar)findViewById(R.id.seekBar);
Text.setTextSize(55);
Text.setText("Hello");
}
But I Can't get it to work by using SeekBar:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
EditText Text = (EditText)findViewById(R.id.editText);
SeekBar f = (SeekBar)findViewById(R.id.seekBar);
Text.setTextSize((float)f.getProgress());
Text.setText("Hello");
}
You can change the text size using this listener:
f.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
// TODO Auto-generated method stub
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
// TODO Auto-generated method stub
}
@Override
public void onProgressChanged(SeekBar seekBar, int progress,boolean fromUser) {
// TODO Auto-generated method stub
Text.setTextSize(progress);
}