scrollview嵌入webview导致自动滚动
来源:互联网 发布:全球生产网络弊端 编辑:程序博客网 时间:2024/06/03 20:16
当我们在界面外层使用了ScrollView,内层又有WebView时,当进入界面后,会导致ScrollView自动滚动到webView刚好可见的位置。
找了下资料,参考链接:https://stackoverflow.com/questions/9842494/how-to-prevent-a-scrollview-from-scrolling-to-a-webview-after-data-is-loaded
布局像这样:
<?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>
发现是一个聚焦的问题,加上下面这行代码就可以了:
android:descendantFocusability="blocksDescendants"
放在这个位置:<LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:descendantFocusability="blocksDescendants" >
阅读全文
0 0
- scrollview嵌入webview导致自动滚动
- ScrollView中EditText导致自动滚动问题
- ScrollView中EditText导致自动滚动问题
- ScrollView中EditText导致自动滚动问题
- ScrollView中EditText导致自动滚动问题
- ScrollView下长度改变后导致自动滚动
- ScrollView滚动视图和WebView
- scrollview 自动滚动
- 禁止ScrollView自动滚动
- ScrollView自动滚动实现
- 禁止ScrollView自动滚动
- scrollview里嵌入webview,显示所有内容
- RecyclerView/ScrollView中条目弹出PopupMenu导致RecyclerView自动滚动的问题
- 解决ScrollView中嵌套ListView或GridView导致的ScrollView自动滚动到ListView或GridView位置的问题
- android 实现ScrollView自动滚动
- 备忘-scrollView自动滚动图片
- Android ScrollView水平自动滚动
- iOS scrollView循环自动滚动
- Linux 文件系统的目录
- 乱码问题!Eclipse 的控制台console必须用GBK编码。【转载】 Eclipse 的控制台必须用GBK编码。所以条件1和条件4必须同时满足否则运行的还是乱码。才能保证不是乱码。
- Finger Search Tree 模板 BZOJ3224
- Android 下拉刷新框架实现
- HI3520D在内核中复用UART2,UART3管脚
- scrollview嵌入webview导致自动滚动
- Git 保存用户名和密码
- linux驱动编程小技巧
- MFC绘制矩形、椭圆、三角形
- 【题解】 同余 poj3292 semi-prime H-number 未完
- struts2的validate验证框架(1)
- go语言并发编程-----Goroutines 并发模式
- Java 数组
- Linux bash 命令