2
탭이있는 메인 스크린이 있습니다. 각 탭이목록에 검은 딸기가 들어 있습니다.
protected boolean navigationClick(int status, int time) {
fieldChangeNotify(1);
return true;
}
및 다른 방법
public boolean isFocusable() {
return true;
}
protected void drawFocus(Graphics graphics,
boolean on) {
// Don't draw the default focus
}
protected void onFocus(int direction) {
super.onFocus(direction);
invalidate();
}
protected void onUnfocus() {
super.onUnfocus();
invalidate();
}
하지만, 내 mainscreen에서는, horizontalfieldmanager에서이 탭의 3이
처럼 보이는 자신의 오버라이드 (override) navigationClick 방법이있다. 재정의 된 fieldChanged는 다음과 같이 구현됩니다.public void fieldChanged(Field field, int context) {
if (_tabArea != null) {
if (field == _tab1) {
delete(_tabArea);
_tabArea = displayTab1();
add(_tabArea);
} else if (field == _tab2) {
delete(_tabArea);
_tabArea = displayTab2();
add(_tabArea);
} else if (field == _tab3) {
delete(_tabArea);
_tabArea = displayTab3();
add(_tabArea);
}
}
}
탭을 전환합니다. 나는 navigationfield를 오버라이드 한 이후로 listfield에 대한 클릭을 처리하는 navigationClick을 아래에 가지고 있지만, 더 이상 탭 전환이 작동하지 않습니다. 누구나 왜 그런 생각이 있니?
protected boolean navigationClick(int status, int time) {
Field field = _listfield;
if(field instanceof ListField)
{
int selected = _listfield.getSelectedIndex();
switch (selected) {
case 0:
delete(_tabArea);
All all = new All();
_tabArea = all.getVFM();
add(_tabArea);
break;
case 1:
break;
}
return true;
}
return super.navigationClick(status, time);
}
예, 다음과 같습니다. http://justpaste.it/mc4 – mikez
필드를 변경했습니다. = _listfield; 필드 필드 = this.getFieldWithFocus(); ... 이제 탭은 작동하지만 목록 항목을 선택하면 작동하지 않습니다. – mikez
this.getFieldWithFocus()를 사용하는 대신 생각합니다. if (field.isFocus()) {// 사용자 코드 //} 다른 필드에 집중할 때 트리거되기 때문에 문제가있을 수 있습니다. –