I have a gridlayout that syncs horizontal scroll with a table thru an ObservableScrollView. I have no problems with this part. When the gridlayout loads I have 12 rows and 12 columns but visible I have 6 rows and 4 columns. I am using the Dpad to scroll to the desired location and set focus. If I scroll down (gridlayout is also wrapped in a scrollview for vertical) to say 3 row and scroll all the way to end of columns I have the following code
The columnindex is set to 0 so it will be the first column of the gridlayout, the rowindex is whatever row I have scrolled to and the myGrid is the View. The columnHolder is set earlier equal to the tempId before it's changed. Basically what this does is located the id of the focused view. All of this works. Once I hit the last column, the focus moves to the 0 column, and sets the id, all perfect. Now, here lies my problem, if I scroll to say to row 10 and then across to last column, the tempId is correct, the rowindex is correct as is the columnindex is correct but the grid resets to show the first 6 rows, it doesn't retain the scrolled to row in a visible location. I know all the variables are correct thru the logcat. I have a Log statement in that shows me what row, column and id that was focused and which is currently focused as I scroll. All works great if I stay within the first 6 visible rows, but if I move below the sixth, the first 6 are drawn when the FOCUS_LEFT is activated. Is there something I must use to retain the desired part of the gridlayout. I'm not changing the view data in any way.
Java:
myhorscroll.fullScroll(ObservableScrollView.FOCUS_LEFT);
columnIndex=0;
tempId = currentId(columnindex, rowindex, myGrid);
myGrid.findViewById(columnHolder).setBackgroundColor(Color.BLUE);
myGrid.findViewById(tempId).setBackgroundColor(Color.GREEN);
The columnindex is set to 0 so it will be the first column of the gridlayout, the rowindex is whatever row I have scrolled to and the myGrid is the View. The columnHolder is set earlier equal to the tempId before it's changed. Basically what this does is located the id of the focused view. All of this works. Once I hit the last column, the focus moves to the 0 column, and sets the id, all perfect. Now, here lies my problem, if I scroll to say to row 10 and then across to last column, the tempId is correct, the rowindex is correct as is the columnindex is correct but the grid resets to show the first 6 rows, it doesn't retain the scrolled to row in a visible location. I know all the variables are correct thru the logcat. I have a Log statement in that shows me what row, column and id that was focused and which is currently focused as I scroll. All works great if I stay within the first 6 visible rows, but if I move below the sixth, the first 6 are drawn when the FOCUS_LEFT is activated. Is there something I must use to retain the desired part of the gridlayout. I'm not changing the view data in any way.