Vaibhav Dhage
Vaibhav Dhage

Reputation: 902

image added from webview adds margin(space) but pure Image does not add any margin in layout

I am trying to add banner ad in my android app. but the banner loaded from webview showed with space or margin. I didn't specified margin anywhere.

Ad space for image is specified 300 x 50 means anything bigger than this go out of focus.

If this space is displayed in webview then image will be displayed partially or cropped from bottom and sides.

This is Image added directly.

enter image description here

This is Image added from webview.

enter image description here

any solution to avoid these margins because I can't customize fixed 300 x 50 fixed size of ad space.

<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>

Ad space is 300 x 50. I can't illustrate it here in layout.. Its added by adserver SDK.

Upvotes: 1

Views: 496

Answers (1)

fasteque
fasteque

Reputation: 4339

Very likely there's a default margin/padding in the html page you show, please check this post to get the solution: Remove unwanted White Space in WebView Android

Upvotes: 2

Related Questions