相关疑难解决方法(0)

WebView scrollTo无效

我正在尝试使用webview的scrollTo方法.这是我的webview布局文件.

<?xml version="1.0" encoding="utf-8"?>  
<LinearLayout  
  xmlns:android="http://schemas.android.com/apk/res/android"  
  android:orientation="vertical"  
  android:layout_width="fill_parent"  
  android:layout_height="fill_parent"   
>  
<WebView  
   android:id="@+id/webMap"  
   android:layout_width="fill_parent"  
   android:layout_height="fill_parent"  
 />  
</LinearLayout> 
Run Code Online (Sandbox Code Playgroud)

我要做的是显示一个html文件(只有一个地图图像)并滚动到图像上的某个区域:

mapWebView.loadUrl("file:///android_asset/maps/map.html");
mapWebView.scrollTo(300, 300);
Run Code Online (Sandbox Code Playgroud)

但是当加载webview时,它总是显示图像的(0,0).

这有什么问题scrollTo()

android android-webview

9
推荐指数
1
解决办法
1万
查看次数

标签 统计

android ×1

android-webview ×1