如何获取搜索栏数据来设置View鳍状肢的速度

时间:2016-10-10 02:06:36

标签: android

如何在第一个活动中从搜索栏获取输入以在第二个活动中设置视图翻板的渗透? 我完全没错,或者我需要为搜索栏设置一个onclick监听器吗?

public class MainActivity extends AppCompatActivity implements View.OnClickListener {

SeekBar seekBar;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    seekBar = (SeekBar) findViewById(R.id.seekBar);
    seekBar.setMax(10);
    View v = findViewById(R.id.button);
    v.setOnClickListener(this);
}

public void onClick(View view){
    if (view.getId() == R.id.button){
        Intent intent = new Intent(this, SlideShow.class);
        this.startActivity(intent);
    }
}
}
public class SlideShow extends AppCompatActivity {

ViewFlipper viewFlipper;
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_slide_show);

    viewFlipper = (ViewFlipper)this.findViewById(R.id.viewFlipper);
    viewFlipper.setAutoStart(true);
    viewFlipper.setFlipInterval(seekBar.getProgress());
    viewFlipper.startFlipping();
}}

0 个答案:

没有答案