I will post the code below, my issue is this, in the emulator (Genymotion Galaxy Nexus 4.2.2) the admob banner stretches and fill its parent:
In a real device (Galaxy Nexus 4.3) the admob banner does not fill the whole width of its parent, leaving two white stripes on the sides:
this is the layout:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<WebView
android:id="@+id/webview"
android:layout_width="fill_parent"
android:layout_height="0px"
android:layout_weight="1"/>
<com.google.android.gms.ads.AdView android:id="@+id/adView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
ads:adUnitId="ca-app-pub-1470640527107044/6766749615"
ads:adSize="SMART_BANNER"/>
</LinearLayout>
and this is the onCreate of the activity:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
setContentView(R.layout.activity_detail);
ActionBar actionBar = getSupportActionBar();
actionBar.setDisplayHomeAsUpEnabled(true);
WebView myWebView = (WebView) findViewById(R.id.webview);
WebSettings webSettings = myWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
Bundle b = getIntent().getExtras();
url = b.getString("url");
myWebView.loadUrl(url);
myWebView.setWebViewClient(new MyWebViewClient());
// Initiate a generic request.
AdRequest adRequest = new AdRequest.Builder().build();
adView = (AdView) findViewById(R.id.adView);
adView.loadAd(adRequest);
}
What am I doing wrong? I have examined it a lot but I can not figure it out...