1
我正在編寫一個專門爲盲人和視力受損而設計的應用程序,並且當特定AccessibilityEvent
被觸發時,我試圖覆蓋TextView
的行爲。屏幕布局由縱向排列的4個TextView
組成,填滿屏幕。我只是想改變背景顏色,以反映之一就是「專注」所以在我的自定義TextView
我有這樣的方法某些AccessibilityEvent未在JellyBean中觸發4.2
@Override
public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) {
System.out.println(event.toString());
if (event.getEventType() == AccessibilityEvent.TYPE_VIEW_HOVER_ENTER ||
event.getEventType() == AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUSED) {
this.setBackgroundColor(mColorArray[2]);
}
if (event.getEventType() == AccessibilityEvent.TYPE_VIEW_HOVER_EXIT ||
event.getEventType() == AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED) {
this.setBackgroundColor(mColorArray[0]);
}
return super.dispatchPopulateAccessibilityEvent(event);
}
我的問題是AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED
永遠不會被解僱。當使用ExploreByTouch或向上/向下滑動左/右時,其他三個人正確觸發。
任何幫助,將不勝感激
[AccessibilityService已啓動,但未收到JellyBean上的AccessibilityEvents]的可能重複(http://stackoverflow.com/questions/12019848/accessibilityservice-is-started-but-does-not-receive-accessibilityevents-on-jell ) – Sufian