关于Android ScrollView嵌套WebView冲突问题

来源:互联网 发布:php就业班54期 编辑:程序博客网 时间:2024/05/01 03:39

最近做项目用到ScrollView中嵌套WebView问题:WebView滑动,ScrollView不滑动。

网上找了找,到解决不了我的问题,不过找到一个android:descendantFocusability="blocksDescendants"(父类焦点覆盖子类焦点);

不过还是没有解决我的问题。因为WebView加载网页比较慢,WebView应该会重新获取焦点;

于是在WebView的父类中加入

android:focusable="true"android:focusableInTouchMode="true"(使子类不获取焦点)然后解决了我的问题.<ScrollViewandroid:descendantFocusability="blocksDescendants"><LinearLayout
android:focusable="true"android:focusableInTouchMode="true"><WebView/></LinearLayout>
</ScrollView>



0 0
原创粉丝点击