我在我的应用程序中自定义了搜索栏。我也可以拖动搜索栏并访问未实现的方法。我的代码是
public class Income extends Activity implements OnSeekBarChangeListener, OnItemSelectedListener
{
SeekBar net_sales1,cogs,operating,other_revenue;
public void onCreate(Bundle bundle)
{
super.onCreate(bundle);
setContentView(R.layout.income);
seek_txt1 = (TextView)findViewById(R.id.net_sales);
seek_txt2 = (TextView)findViewById(R.id.cogs_te);
seek_txt3 = (TextView)findViewById(R.id.operate_exp);
seek_txt4 = (TextView)findViewById(R.id.other_rev);
net_sales1 = (SeekBar)findViewById(R.id.mySeekingBar1);
cogs = (SeekBar)findViewById(R.id.mySeekingBar2);
operating = (SeekBar)findViewById(R.id.mySeekingBar3);
other_revenue = (SeekBar)findViewById(R.id.mySeekingBar4);
net_sales1.setOnSeekBarChangeListener(this);
cogs.setOnSeekBarChangeListener(this);
operating.setOnSeekBarChangeListener(this);
other_revenue.setOnSeekBarChangeListener(this);
}
@Override
public void onProgressChanged(SeekBar seekBar, int progress,boolean fromUser)
{
seek_count=0;
progress1=progress-150;
verify = fromUser;
if (fromUser)
{
if (progress >= 0 && progress <= seekBar.getMax())
{
progressString = String.valueOf(10*progress-150);
}
}
seek_id=seekBar.getId();
switch(current_spinner)
{
case R.id.mySeekingBar1 :
//tablelay.removeView(tableLayout);
seek_txt1.setText(progressString);
int seekbar1_val = Integer.parseInt(seek_txt1.getText().toString());
progress_of_spinner1 = progress;
break;
case R.id.mySeekingBar2 :
seek_txt2.setText(progressString);
progress_of_spinner2 = progress;
break;
case R.id.mySeekingBar3 :
seek_txt3.setText(progressString);
progress_of_spinner3 = progress;
break;
case R.id.mySeekingBar4 :
seek_txt4.setText(progressString);
progress_of_spinner4 = progress;
break;
}
net_sales1.setProgress(progress_of_spinner1);
cogs.setProgress(progress_of_spinner2);
operating.setProgress(progress_of_spinner3);
other_revenue.setProgress(progress_of_spinner4);
}
@Override
public void onStartTrackingTouch(SeekBar seekBar)
{
int progress2 = progress1;
originalProgress=seekBar.getProgress();
}
@Override
public void onStopTrackingTouch(SeekBar seekBar)
{
progress2=progress1;
}
现在我的问题是,是否可以在活动的 onCreate() 方法中访问所有未实现的搜索栏方法?有没有机构可以告诉我?提前致谢。