NestedScrollView中webview被点击,NestedScrollView会滑动,感觉像跳动一下
解决办法在webview父布局中加上
android:descendantFocusability="blocksDescendants"
android:descendantFocusability="blocksDescendants"的意思是,父布局拦截子view的事件
android:descendantFocusability还有三个属性
beforeDescendants:viewgroup会优先其子类控件而获取到焦点
afterDescendants:viewgroup只有当其子类控件不需要获取焦点时才获取焦点,这个以前经常用于listview item里面子view点击,
现在换成rv基本用不上了
blocksDescendants:viewgroup会覆盖子类控件而直接获得焦点
本文介绍了解决NestedScrollView中WebView被点击时出现的跳动问题的方法。通过在WebView的父布局中设置android:descendantFocusability=blocksDescendants属性,可以阻止NestedScrollView的滑动行为,避免视觉上的跳动感。文章详细解释了该属性的三种模式及其作用。
476





