我無法將焦點設置爲具有兩個LabelFields
的HorizontalFieldManager
。我想在焦點時突出顯示HorizontalFieldManager
。我正在使用下面的代碼,但它不工作。無法將焦點設置爲HorizontalFieldManager
HorizontalFieldManager hrzMgrTimeLabel = new HorizontalFieldManager(
Manager.USE_ALL_HEIGHT|Manager.FOCUSABLE) {
protected void onFocus(int direction) {
focussed = true;
invalidate();
super.onFocus(direction);
}
protected void onUnfocus() {
focussed = false;
invalidate();
super.onUnfocus();
}
protected void paint(Graphics g) {
g.setBackgroundColor(0x646060);
if (focussed) {
g.setColor(Color.BLUE);
}
g.clear();
super.paint(g);
}
};
hrzMgrTimeLabel.add(a);
hrzMgrTimeLabel.add(b);
horizontalFieldManager_left15.add(hrzMgrTimeLabel);
下面是執行的LabelField。
final LabelField a= new LabelField("") {
protected void paint(Graphics graphics) {
graphics.setColor(Color.WHITE);
graphics.setBackgroundColor(0x646060);
graphics.clear();
super.paint(graphics);
}
};
final LabelField b= new LabelField("") {
protected void paint(Graphics graphics) {
graphics.setColor(Color.WHITE);
graphics.setBackgroundColor(0x646060);
graphics.clear();
super.paint(graphics);
}
};
更新你的問題,你可以使用一些圖像來解釋你想達到什麼。 – Rupak
我有兩個labfetields,其中一個數據是7,另一個是我正在添加到HFM中的數據,我想關注它。 – harqs
聚焦時,您是否需要更改HorizontalFieldManager的背景顏色? – Rupak