
AndroID 中VIEwPager中使用WebVIEw的注意事项
前言:
今天在做项目时遇到了一个小问题
首先使用VIEwPager显示多个页面,然后在每个页面上使用Fragment显示数据,其中有一部分数据是通过WebVIEw加载的HTML标签。
具体xml布局如下
<?xml version="1.0" enCoding="utf-8"?><ScrollVIEw xmlns:androID="http://schemas.androID.com/apk/res/androID" androID:layout_wIDth="fill_parent" androID:layout_height="fill_parent" androID:background="@color/background" > <linearLayout androID:layout_wIDth="match_parent" androID:layout_height="wrap_content" androID:orIEntation="vertical" > <TextVIEw androID:ID="@+ID/article_Title" androID:layout_wIDth="fill_parent" androID:layout_height="wrap_content" androID:layout_marginRight="10dp" androID:layout_marginleft="10dp" androID:layout_margintop="10dp" androID:layout_marginBottom="2dp" androID:text="Some Title" androID:textAppearance="?androID:attr/textAppearanceLarge" androID:textcolor="@color/article_Title" androID:textStyle="bold" /> <linearLayout androID:ID="@+ID/LL_Seperator" androID:layout_wIDth="fill_parent" androID:layout_height="1dp" androID:layout_marginleft="10dp" androID:layout_marginRight="10dp" androID:layout_margintop="5dp" androID:layout_marginBottom="5dp" androID:background="@color/text" androID:orIEntation="horizontal" > </linearLayout> <WebVIEw androID:ID="@+ID/article_content" androID:layout_wIDth="match_parent" androID:layout_marginRight="10dp" androID:layout_marginleft="10dp" androID:layout_height="wrap_content" /> <TextVIEw androID:ID="@+ID/article_link" androID:layout_wIDth="fill_parent" androID:layout_height="wrap_content" androID:layout_marginBottom="5dp" androID:layout_margintop="5dp" androID:layout_marginRight="10dp" androID:layout_marginleft="10dp" androID:text="VIEw Full Article" androID:textcolor="@color/article_Title" androID:textStyle="bold" /> </linearLayout></ScrollVIEw>
问题是当数据加载完毕之后,WebVIEw会自动移动到页面的最顶端,如果用户想查看处于WebVIEw上方的TextVIEw内容则必须手动将页面往下拉
解决以上问题可以在ScrollvIEw中所使用的linearLayout添加如下属性:
androID:descendantFocusability="blocksDescendants"
如有疑问请留言或到本站社区交流讨论,感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!
总结以上是内存溢出为你收集整理的Android 中ViewPager中使用WebView的注意事项全部内容,希望文章能够帮你解决Android 中ViewPager中使用WebView的注意事项所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)