Android - 如何阅读触摸监听器的辅助功能

问题描述 投票:0回答:1

我正在使用 Android 触摸监听器。当我在 Android 中激活辅助功能时,它显示为“双击即可激活”。但是当我双击操作时不起作用。当我在该视图中用双指触摸时,Insteed Action 就会起作用。如何更改辅助功能消息?我想读像“用双指触摸来激活”。请帮我解决这个问题。

ed_text = findViewById(R.id.ed_text);
        ed_text.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {

                if (event.getAction() == MotionEvent.ACTION_DOWN) {

                    Toast.makeText(MainActivity.this,"ACTION_DOWN", Toast.LENGTH_LONG).show();

                } else if (event.getAction() == MotionEvent.ACTION_UP) {

                    Toast.makeText(MainActivity.this,"ACTION_UP", Toast.LENGTH_LONG).show();

                } else if (event.getAction() == MotionEvent.ACTION_CANCEL) {

                    Toast.makeText(MainActivity.this,"ACTION_CANCEL", Toast.LENGTH_LONG).show();
                }

                return false;
            }
        });
android accessibility
1个回答
0
投票

@Vijayadhas Chandrasekaran 您应该使用 OnClickListener 代替,或者在自定义视图类中或通过 setAccessibilityDelegate 重写视图的 PerformAccessibilityAction。

© www.soinside.com 2019 - 2024. All rights reserved.