seekBar和刷新

时间:2013-01-03 19:27:14

标签: android

我有一个seekBar,我可以增加和减少文本大小,但我有一个问题:当我通过seekBar更改tha值并按下按钮(x ++)时,新的TextSwitched可以,但如果再次按下我已经老了价值(文字减少)。再次按下我有新值...当我按下按钮时,读取日志值不会改变。仅在使用seekBar时值才会更改。感谢您的耐心等待。

seekBar1.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {
          public void onStopTrackingTouch(SeekBar seekBar) {
          // TODO Auto-generated method stub
          if(seek<10)
          {
          seek=10;
          seekBar1.setProgress(seek);
          }

          }
          public void onStartTrackingTouch(SeekBar seekBar) {
          // TODO Auto-generated method stub
          }
          public void onProgressChanged(SeekBar seekBar, int progress,boolean fromUser) {
          // TODO Auto-generated method stub
          seek=progress;

          TextView t = (TextView) mSwitcher.getChildAt(0); 
          t.setTextSize(seek);
          Log.i("MyActivity", "MyClass.getView() — list " + seek);

          SharedPreferences prefs = getSharedPreferences(PRIVATE_PREF, 0);
          SharedPreferences.Editor editor = prefs.edit();
          editor.putInt("seek", seek);
          editor.putInt("progress", progress);
          editor.commit();

按钮:

button2.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                    x++;
                    mSwitcher.setText(""+prog[x]);

public view makeView(){     TextView t = new TextView(this);

return t;

0 个答案:

没有答案