detect key event on HorizontalScrollView

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

detect key event on HorizontalScrollView

Postby danielbenedykt » Tue Jul 28, 2009 12:09 am

Hi

In my Activity I have a HorizontalScrollView.

I am trying to get the on key events for left and right from the
hardware.

So I put the following code:

horizontalScrollViewContainer.setOnKeyListener(new OnKeyListener() {

public boolean onKey(View v, int keyCode, KeyEvent event) {
Log.d(TAG, "KEY=" + keyCode);
return false;
}
});

This code is never executed.

Then I put the following code to try to catch the event for the
activity:

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
Log.d(TAG, "onKeyDown");
return false;
}

BUT this event is only fired when the HorizontalScrollView is at the
begining or at the end.
When the right key is pressed and the HorizontalScrollView is moved
to the right, no event is fired.

Does anyone knows how to read the event?

Thanks

Daniel
danielbenedykt
Freshman
Freshman
 
Posts: 7
Joined: Tue May 26, 2009 1:33 am

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: Majestic-12 [Bot] and 5 guests