HOVER_EXIT에서 클릭 동작을 수행 할 수 있지만 TalkBack에서 정상적인 두 번 클릭 동작이 발생하지 않도록하려면 몇 가지 작업을 수행해야합니다. 전화 걸기의 DialPadImageButton은이 동작의 좋은 예입니다. 다음은 해당 클래스의 코드 중 일부 관련 부분입니다.
@Override
public boolean onHoverEvent(MotionEvent event) {
// When touch exploration is turned on, lifting a finger while inside
// the button's hover target bounds should perform a click action.
if (mAccessibilityManager.isEnabled()
&& mAccessibilityManager.isTouchExplorationEnabled()) {
switch (event.getActionMasked()) {
case MotionEvent.ACTION_HOVER_ENTER:
// Lift-to-type temporarily disables double-tap activation.
setClickable(false);
break;
case MotionEvent.ACTION_HOVER_EXIT:
if (mHoverBounds.contains((int) event.getX(), (int) event.getY())) {
simulateClickForAccessibility();
}
setClickable(true);
break;
}
}
return super.onHoverEvent(event);
}
/**
* When accessibility is on, simulate press and release to preserve the
* semantic meaning of performClick(). Required for Braille support.
*/
private void simulateClickForAccessibility() {
// Checking the press state prevents double activation.
if (isPressed()) {
return;
}
setPressed(true);
// Stay consistent with performClick() by sending the event after
// setting the pressed state but before performing the action.
sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_CLICKED);
setPressed(false);
}
안녕하세요 @ Amir .. 거기에 어떤 해결책이 있습니까 ?? – Prabs