当前位置:网站首页>Scrollview is not at the top during initialization?

Scrollview is not at the top during initialization?

2022-06-10 14:37:00 yechaoa

It is often used in daily development ScrollView Nested controls , such as RecyclerView、 Customize View、 Dynamically created View wait

During initialization, you may directly slide to the child View The location of , This is because of the son view Actively request and get the focus

So , The solution is simple , stay ScrollView Or add two attributes to the outer root layout , It means to get the focus back

android:focusable="true"
android:focusableInTouchMode="true"
原网站

版权声明
本文为[yechaoa]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/161/202206101411130027.html