I am trying to make the Gallery scroll with animation to left or right when user click on either the left or right buttons. It works well if I use the below code to invoke the keyevent to scroll the gallery:
gallery.onKeyDown(KeyEvent.KEYCODE_DPAD_LEFT, new KeyEvent(0, 0));
or
KeyEvent evtKey = new KeyEvent(0, KeyEvent.KEYCODE_DPAD_RIGHT);
gallery.dispatchKeyEvent(evtKey);
But once I set any value to the Gallery spacing, the code above stop working. Any clue why this is so?
This is my answer.