I'm new to android and I want to know how to identify the hover view when moving finger on different views. As a example if my activity has 5 LinearLayouts A,B,C,D,E and if I moving from C to B then to E I want to identify that. Please if someone knows how to implement that can you give me an example.
Code that I have tried so far..
@Override
public boolean onTouch(View v, MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_HOVER_ENTER) {
switch (v.getId()) {
case R.id.linearLayoutA:
Log.d(getClass().getSimpleName(), "entered A");
break;
case R.id.linearLayoutB:
Log.d(getClass().getSimpleName(), "entered B");
break;
case R.id.linearLayoutC:
Log.d(getClass().getSimpleName(), "entered c");
break;
case R.id.linearLayoutD:
Log.d(getClass().getSimpleName(), "entered d");
break;
case R.id.linearLayoutE:
Log.d(getClass().getSimpleName(), "entered e");
break;
}
}
return true;
}
Thank you.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…