在我的webview活動中,我可以垂直滾動網頁(向上和向下),但我無法水平滾動(從右到左或從左到右),當我縮放網頁時也沒有水平滾動。在webview中啓用水平滾動
有沒有可能在webview中添加它? 非常感謝。
getWindow().setFeatureInt(Window.FEATURE_PROGRESS, Window.PROGRESS_VISIBILITY_ON);
mWebView = (WebView) findViewById(R.id.webview);
mWebView.getSettings().setBuiltInZoomControls(true);
mWebView.getSettings().setSupportZoom(true);
mWebView.setVerticalScrollBarEnabled(true);
mWebView.setWebChromeClient(new WebChromeClient() {
public void onProgressChanged(WebView view, int progress)
{
//Make the bar disappear after URL is loaded, and changes string to Loading...
MyActivity.setTitle("Loading...");
MyActivity.setProgress(progress * 100); //Make the bar disappear after URL is loaded
// Return the app name after finish loading
if(progress == 100)
MyActivity.setTitle(R.string.app_name);
}
});
mWebView.setWebViewClient(new Manipulation());
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.loadUrl(myURL);
XML:
<?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/webview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
</LinearLayout>
傳統的WebView在安德烈oid默認支持水平滾動。也許你在代碼中以某種方式禁用它,或者你沒有查看水平滾動的頁面? – bbedward 2012-03-07 13:56:02
@bbedward:請看看我的代碼 – androniennn 2012-03-07 14:16:40