How to control accessibility focus for swipe down

2019-08-10 20:16发布

问题:

I have a layout that looks like this.

The view on the upper right (black background with white text) is a PopupWindow that is displayed on this view as follows:

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    btnShow = (Button) findViewById(R.id.btn_show);
    showToolTip();
}


private void showToolTip() {
    final PopupWindow popupWindow = new PopupWindow(this);
    popupWindow.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);
    popupWindow.setWidth(ViewGroup.LayoutParams.WRAP_CONTENT);
    popupWindow.setContentView(getLayoutInflater().inflate(R.layout.popcontent, null));
    btnShow.post(new Runnable() {
        @Override
        public void run() {
            popupWindow.showAsDropDown(btnShow);
        }
    });
}

Now when talk back is on I can navigate this screen by using the swipe down gestures which results in the following focus points

First -> last focus

TooltipTest (title) -> Dismiss button -> S button -> Hello World Text View - > Bottom button -> tooltip

Question How can I change this sequence so that the tool tip is read/receives accessibility focus after the S button?