当前位置:网站首页>RecyclerView通过DPAD按键上下切换焦点 切换到界面外的控件时焦点会左右乱跳
RecyclerView通过DPAD按键上下切换焦点 切换到界面外的控件时焦点会左右乱跳
2022-07-29 04:28:00 【呈叙墨客】
焦点乱跳原因
乱跳原因Android原生焦点跳转逻辑设计如此(算是bug吧)。
原生逻辑是根据屏幕显示位置来计算下一个焦点位置,但在切换到屏幕外面时会有问题,比如第2列上移到屏幕为会跳到第3列,第1列下移到屏保外时,会跳到第1列。
解决办法
无效的解决办法:重写 dispatchKeyEvent,如果是在最底部,按键事件派发时,view还没创建。无法解决屏幕外的焦点控制。
有效解决办法:
重写 requestChildFocus 和 dispatchKeyEvent。
package com.android.xxx.view;
import android.content.Context;
import <边栏推荐
- Use of torch.optim optimizer in pytorch
- Dasctf2022.07 empowerment competition
- STL source code analysis (Hou Jie) notes -- Classification and testing of stl containers
- Oracle update and delete data
- TypeError: Cannot read properties of undefined (reading ‘then‘)
- leetcode 686.重复叠加字符串 KMP方法(C语言实现)
- [C] PTA 6-8 finding the height of binary tree
- C language: summary of consortium knowledge points
- Exception resolution: error of not finding edu.stanford.nlp.semgraph.semgrex.semgrexpattern in cococaption package
- TypeError: Cannot read properties of undefined (reading ‘then‘)
猜你喜欢

String, array, generalized table (detailed)

Don't insist on 66 days. Weight generates random numbers

Several simple and difficult OJ problems with sequential force deduction

LeetCode_ Stack topics

6.pytest生成allure报告
![[express connection to MySQL database]](/img/a6/d68327fa74b8c94d250ea469301839.png)
[express connection to MySQL database]

你真的会写Restful API吗?

Christmas tree web page and Christmas tree application

Star a pathfinding in LAYA

TypeError: Cannot read properties of undefined (reading ‘then‘)
随机推荐
Dasctf2022.07 empowerment competition
Tower of Hanoi classic recursion problem (C language implementation)
WebRTC实现简单音视频通话功能
[c language] PTA 7-48 find the number of combinations
Simply change the picture color
[C] PTA 6-8 finding the height of binary tree
The daily life of programmers
[c language] PTA 7-55 query fruit price
LeetCode_ Stack topics
settings.xml
STL source code analysis (Hou Jie) notes - STL overview
Down sampling and up sampling
Introduction and examples of parameters in Jenkins parametric construction
[material delivery UAV] record (ROS + Px4 + yolov5 + esp8266 + steering gear)
Can you really write restful API?
JVM (heap and stack) memory allocation
It won't last for 70 days. The k-largest number in the array
Integration of Nan causes in pytorch training model
MySQL - 聚簇索引和辅助索引
Update learning materials daily