gpt4 book ai didi

Android - webview 中断

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:14:39 26 4
gpt4 key购买 nike

我目前有一个显示当前站点的 webview。但是,它会切断页面的一侧。见下图。有没有什么办法解决这一问题?也请参阅下面的代码和 xml。谢谢!

图片:

enter image description here

代码:

    // create alert dialog
blogDialog = new AlertDialog.Builder(BlogActivity.this).create();

// add progress bar support
getWindow().requestFeature(Window.FEATURE_PROGRESS);

// make progress bar visible
getWindow().setFeatureInt(Window.FEATURE_PROGRESS,
Window.PROGRESS_VISIBILITY_ON);

setContentView(R.layout.webtab);

sdrWebView = (WebView) findViewById(R.id.sdrwebview);
sdrWebView.getSettings().setJavaScriptEnabled(true);

// set web view zoom
//sdrWebView.setInitialScale(scaleInPercent)

// set the width,zoom function, and other settings
sdrWebView.getSettings().setUseWideViewPort(true);
//sdrWebView.getSettings().getUseWideViewPort(true);
sdrWebView.setInitialScale(0);
sdrWebView.getSettings().setBuiltInZoomControls(false);
sdrWebView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
sdrWebView.canGoBack();
sdrWebView.getSettings().setAllowFileAccess(true);
sdrWebView.getCertificate();

// remove scrollbar
sdrWebView.setVerticalScrollBarEnabled(false);

// set the URL
sdrWebView.loadUrl("http://www.stopdroprave.com");

//enable flash
sdrWebView.getSettings().setJavaScriptEnabled(true);

XML:

<RelativeLayout 
android:id="@+id/relativeLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:orientation="vertical">
<WebView
android:id="@+id/sdrwebview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>
</RelativeLayout>

最佳答案

这里有两种可能性:

  1. 查看您的父 View (tabhost 布局)中是否有填充/边距。

  2. 将以下内容添加到您的:

<supports-screens android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="true"
android:anyDensity="true" />

关于Android - webview 中断,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8012936/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com