【发布时间】:2013-12-05 09:13:18
【问题描述】:
您好,我正在为我的 webview 使用此代码来加载一些 html 数据。它工作得非常完美,但在右侧显示了额外的空白。
WebView tvone = (WebView) findViewById(R.id.web);
tvone.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
tvone.setWebViewClient(new WebViewClient() {
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
pd = ProgressDialog.show(viewdetails.this, "", "Laden", true);
pd.setCancelable(true);
super.onPageStarted(view, url, favicon);
}
@Override
public void onPageFinished(WebView view, String url) {
pd.dismiss();
}
});
tvone.loadDataWithBaseURL(null, html_data, "text/html", "utf-8", null);
我使用 onTouchListener 使用了一些技巧,这解决了问题,但链接不起作用。我需要使用 webview 中的工作链接删除空间。 请帮助我是新手。
编辑
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffff"
android:gravity="center" >
<WebView
android:id="@+id/textView2"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:layout_marginTop="10dp"
/>
【问题讨论】:
-
您能否提供屏幕截图并说明您要删除的空间。
-
发布您的布局文件。
-
请检查编辑,第二张图片显示右侧的空白
-
webview的父级layout是否有paddingLeft? -
是的,有一个 paddingLeft 。但即使我删除它也没有用
标签: android html webview android-webview