您可能會在父管理器中混淆nextFocus()
以跳過中間的VFM。也許也可以覆蓋onFocus()
中間,然後轉到下一個。我知道它應該通過將其設置爲不可聚焦的方式來完成此操作,但可能會覆蓋isFocusable()
以返回false。
protected boolean navigationMovement(int dx, int dy, int status, int time) {
if (getField(getFieldWithFocusIndex()) == tabbar) {
Field f = tabbar.getFieldWithFocus();
if (f == lastTabButton) {
if (dy > 0) {
tabData.setFocus();
return true;
}
} else if (f == firstTabButton) {
if (dy < 0) {
return true;
}
}
} else if (getField(getFieldWithFocusIndex()) == tabData) {
MyTab tab = (MyTab) tabs.get(tabData);
if (tab != null && !tab.willHandleNavigationMovement(dx, dy)) {
if (dy != 0) {
if (dy < 0)
lastTabButton.setFocus();
return true;
}
}
}
return super.navigationMovement(dx, dy, status, time);
}
你會在上面,我不得不也覆蓋從向上滾動時行爲的代碼見:
謝謝。已經嘗試過這些。 *焦點*從不進入中間的VFM。它一直保持在VFM之上,直到VFM滾動到底部,此時它跳到VFM下方。 –
啊有趣...也許增加一個ScrollChangeListener,如果它開始重置它回到垂直0和改變焦點? – jprofitt
另一個好主意,不幸的是,我確實需要VFM滾動,只是當我以編程方式告訴它時,而不是當用戶嘗試移動光標時。嗯,但也許如果我讓我的滾動邏輯非常複雜,我可以告訴我的滾動和操作系統滾動之間的區別... –