我seekbar
在安卓中使用。我在string.xml
我想要的数组中创建了一个数组,当我移动搜索栏时,只要我移动搜索栏,就应该在文本视图上打印数组的值,文本视图上的值应该被更改。
这是我的代码 -
Java 文件
public class SliderActivity extends Activity
{
SeekBar seekbar;
TextView txt1,txt2;
String item[];
int count=0;
File file;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_PROGRESS);
setContentView(R.layout.main);
item=getResources().getStringArray(R.array.myArray);
seekbar=(SeekBar)findViewById(R.id.seekBar1);
txt1=(TextView)findViewById(R.id.textView1);
txt2=(TextView)findViewById(R.id.textView2);
seekbar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener()
{
public void onStopTrackingTouch(SeekBar bar)
{
txt2.setText("seekbar has been stop");
}
public void onStartTrackingTouch(SeekBar bar)
{
txt2.setText("seekbar has started");
}
public void onProgressChanged(SeekBar bar,int paramInt, boolean paramBoolean)
{
txt1.setText("");
}
});
}
}