I’m trying to use the new event onHover. I look the sample, the documentation…and nothing works. The onHover event should be done by a mouse pointer.
I create a simple xml file containing 1 LinearLayout and 2 buttons inside.
My java code is following
findViewById(R.id.linearLayout1).setOnHoverListener(new OnHoverListener() {
@Override
public boolean onHover(View v, MotionEvent event) {
Log.e("tag", "tag");
return false;
}
});
LinearLayout1 is my linearlayout containing button. onHover is never called.
I tried a lot of stuff without success.
Let me know if you have an idea.
In a
Viewthat contains sub views, the subViews callbacks get called first.if you have a button in your
LinearLayout, all events are being called on the button and all the other views first, and only if all the sub views returnfalse, only then, the event will be called on the parent view.you should return false from all other subviews first before activating the
onHover