and*_*nnn 15 android android-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);
Run Code Online (Sandbox Code Playgroud)
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>
Run Code Online (Sandbox Code Playgroud)
Vin*_*tti 24
用这个
mWebView.getSettings().setUseWideViewPort(true);
Run Code Online (Sandbox Code Playgroud)
这可能是由于以下任何因素造成的
setLoadWithOverviewMode(true)加载WebView完全缩小
setUseWideViewPort(true)使得Webview具有普通视口(例如普通桌面浏览器),而当为false时,webview将具有约束于其自身尺寸的视口(因此,如果webview为50px*50px,则视口将具有相同的大小)
要么
Webview.setInitialScale(xx);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
16728 次 |
| 最近记录: |