Android 按键 修复在全部应用下,↓键可以实现下移

Posted 王睿丶

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Android 按键 修复在全部应用下,↓键可以实现下移相关的知识,希望对你有一定的参考价值。

frameworks/base/core/java/android/view/ViewRootImpl.java

private boolean performFocusNavigation(KeyEvent event) 
 switch (event.getKeyCode()) 
                case KeyEvent.KEYCODE_DPAD_LEFT:
                    if (event.hasNoModifiers()) 
                        direction = View.FOCUS_LEFT;
                    
                    break;
                case KeyEvent.KEYCODE_DPAD_RIGHT:
                    if (event.hasNoModifiers()) 
                        direction = View.FOCUS_RIGHT;
                    
                    break;
                case KeyEvent.KEYCODE_DPAD_UP:
                    if (event.hasNoModifiers()) 
                        direction = View.FOCUS_UP;
                    
                    break;
+                case KeyEvent.KEYCODE_DPAD_DOWN:
+                    //wangrui For Settings.apk, let the ↓ key have the function of selecting the first-level directory. In other cases, the ↓ key will be performed in the default way.
+                    if (!("com.android.settings".equals(cn.getPackageName())))
+                        if (event.hasNoModifiers()) 
+                            direction = View.FOCUS_DOWN;
+                        
+                        break;
+                    
                case KeyEvent.KEYCODE_TAB:
                    if (event.hasNoModifiers()) 
                        direction = View.FOCUS_FORWARD;
                     else if (event.hasModifiers(KeyEvent.META_SHIFT_ON)) 
                        direction = View.FOCUS_BACKWARD;
                    
                    break;
            

以上是关于Android 按键 修复在全部应用下,↓键可以实现下移的主要内容,如果未能解决你的问题,请参考以下文章

Android 11.0 修复同时播放音乐和视频时,上一首下一首暂停按键失灵

Android 按键 修复:按Backspace或者delete键有时候不能删掉最近运行

Android 11.0 在全部应用界面下,实现键盘↓键可以下移效果

按键精灵与逍遥安卓ADB连接重键方法

Android App监听软键盘按键的三种方式

Android 11.0 修复在Settings首页,按键盘方向键不会全部选中而是选中单个选项