Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/207.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 从webview添加的图像会添加边距(空格),但纯图像不会在布局中添加任何边距_Android_Html_Android Layout_Webview_Ads - Fatal编程技术网

Android 从webview添加的图像会添加边距(空格),但纯图像不会在布局中添加任何边距

Android 从webview添加的图像会添加边距(空格),但纯图像不会在布局中添加任何边距,android,html,android-layout,webview,ads,Android,Html,Android Layout,Webview,Ads,我正在尝试在我的android应用程序中添加横幅广告。 但从webview加载的横幅显示有空格或边距。我没有在任何地方指定边距 指定图像的广告空间为300 x 50意味着任何大于此范围的内容都会失去焦点 如果此空间显示在webview中,则图像将部分显示或从底部和侧面裁剪 这是直接添加的图像。 这是从webview添加的图像。 因为我无法自定义固定大小的300 x 50广告空间,所以没有任何解决方案可以避免这些空白 <RelativeLayout xmlns:android="http

我正在尝试在我的android应用程序中添加横幅广告。 但从webview加载的横幅显示有空格或边距。我没有在任何地方指定边距

指定图像的广告空间为300 x 50意味着任何大于此范围的内容都会失去焦点

如果此空间显示在webview中,则图像将部分显示或从底部和侧面裁剪

这是直接添加的图像。

这是从webview添加的图像。

因为我无法自定义固定大小的300 x 50广告空间,所以没有任何解决方案可以避免这些空白

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity" >
     <WebView
        android:id="@+id/webview1"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@drawable/bann" /> 

</RelativeLayout>


广告空间为300 x 50。我不能在这里用布局来说明。。它是由adserver SDK添加的。

很可能在您显示的html页面中有默认边距/填充,请查看此帖子以获得解决方案:

您可以发布您的布局吗?谢谢。@fasteque添加了布局。您检查过了吗?哦,我在那个帖子里找到的!!解决了的。谢谢@fasteque。我怎样才能接受这个答案并将这个问题标记为已解决。我发现html页面的默认边距和填充是10px(从未遇到过这个事实:/)。添加了样式
html,body{margin:0px;padding:0px;}
很高兴你解决了这个问题,我在下面添加了我的答案。