我要做的是从ontouch事件中可见的隐形搜索栏获得焦点。让我用一些代码更好地解释一下:
findViewById(R.id.myview).setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
mSeekBar.setVisibility(View.VISIBLE);
//now it becomes visible and i need to start moving the seekbar (left or right) while keeping touch
break;
case MotionEvent.ACTION_MOVE:
break;
case MotionEvent.ACTION_UP:
mSeekBar.setVisibility(View.GONE);
//once touch released hide the seekbar and stop tracking
break;
}
return true;
}
});
答案 0 :(得分:0)
你为什么要这样做?您的代码会在用户按下时显示SeekBar,只有在用户抬起手指时才会使其不可见。除非你进行多点触控处理,否则没有机会与SeekBar实际交互。