问题是我的Activity有一个启用了ScrollBar的TextView。但我的Activity也有OnTouchListener,它们无法正常工作。当我滚动TextView也称为OnTouchListenet,但我想这样做: 当用户滚动时,TextView OnTouchListener不会调用。我怎样才能做到这一点?
OnTouch的代码(); :
select *
from DBA_PROFILES
where resource_name = 'IDLE_TIME'
;
PROFILE RESOURCE_NAME RESOURCE_TYPE LIMIT COMMON
-------------------- --------------- --------------- --------------- ------
DEFAULT IDLE_TIME KERNEL UNLIMITED NO
ORA_STIG_PROFILE IDLE_TIME KERNEL 15 NO
2 rows selected.
}
onCreate();
代码public boolean onTouch(View v, MotionEvent event) {
Display display = ((WindowManager) getSystemService(WINDOW_SERVICE)).getDefaultDisplay();
Point p = new Point();
display.getSize(p);
int width = p.x;
float x = event.getX();
float widthOfOnePart = width/3;
switch (event.getAction()){
case MotionEvent.ACTION_DOWN:
if (x < widthOfOnePart)
Toast.makeText(this, "Переход на предидущую страницу", Toast.LENGTH_SHORT).show();
if (x >= widthOfOnePart & x < widthOfOnePart * 2) {
Animation transDown = AnimationUtils.loadAnimation(this, R.anim.trnslatedown);
Animation transUp = AnimationUtils.loadAnimation(this, R.anim.translateup);
if (topBar.getVisibility() == View.INVISIBLE) {
topBar.setAnimation(transDown);
topBar.setVisibility(View.VISIBLE);
bottomBar.show();
}
else {
topBar.setAnimation(transUp);
topBar.setVisibility(View.INVISIBLE);
bottomBar.dismiss();
}
}
if (x >= widthOfOnePart * 2)
Toast.makeText(this, "Переход на слеующую страницу", Toast.LENGTH_SHORT).show();
break;
}
return true;