1
更新:Thx爲答案,問題已解決。 是代碼丟失,我正在使用Mapsforge庫。如何以編程方式在圓上動態更改顏色
它沒有任何事情比在sqlite查找 導致沒有調用toggleColor()的壞比較。現在它工作得很好!
嗨我無法改變在畫布上繪製的圓的顏色。另一種顏色表示圓的不同狀態。
它,當我點擊屏幕上的圓圈正常工作帶有OnTap即,但是當我嘗試這樣做編程像 circle.toggleColor(),然後 circle.requestRedraw()什麼也不會發生。
如何以編程方式使此工作?
@Override
public boolean onTap(LatLong geoPoint, Point viewPosition, Point tapPoint) {
if (this.contains(viewPosition, tapPoint)) {
toggleColor();
this.requestRedraw();
return true;
}
return false;
}
@Override
private void toggleColor() {
if (this.getPaintFill().equals(LongPressAction.GREEN)) {
this.setPaintFill(LongPressAction.RED);
} else {
this.setPaintFill(LongPressAction.GREEN);
}
}
'requestRedraw'在SDK的任何一個類中都沒有這樣的方法 – pskink
您應該在這裏粘貼與您的問題相關的所有代碼。否則很難找到原因。 – starkshang