Admob | Increase banner size?

My goal is to create an admob banner at the bottom of the screen, as in this photo: http://goo.gl/3POR1n But I do not know how to make the banner sit on the screen because of a higher layout, I installed the add-on.

LogCat says: not enough space to display ads. It requires 320x50 dp, but has only 288x135 dp.

How to extend my space and how to install a banner below?

My xml layout:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:ads="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/background" android:orientation="vertical" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context="eu.gabrielatanasov.demoViewer.Home_activity" > <ImageView android:id="@+id/img_logo" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="@string/img_logo" <Button android:id="@+id/btn_subscription" style="@style/button" android:layout_marginTop="1dp" android:text="@string/btn_subscription" /> <LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical"> <com.google.android.gms.ads.AdView android:id="@+id/adView" android:layout_width="fill_parent" android:layout_height="fill_parent" ads:adSize="SMART_BANNER" ads:adUnitId="@string/adMob_ID" > </com.google.android.gms.ads.AdView> </LinearLayout> </LinearLayout> 

My dens.xml:

 <resources> <!-- Default screen margins, per the Android Design guidelines. --> <dimen name="activity_horizontal_margin">16dp</dimen> <dimen name="activity_vertical_margin">16dp</dimen> </resources> 

My activity:

 package eu.gabrielatanasov.demoViewer; import com.google.android.gms.ads.*; import android.app.Activity; import android.content.Context; import android.os.Bundle; import android.os.Vibrator; import android.view.View; import android.view.Window; import android.widget.Button; public class Home_activity extends Activity { Button btn_subscription; AdView adView; @Override protected void onCreate(Bundle savedInstanceState) { requestWindowFeature(Window.FEATURE_NO_TITLE); overridePendingTransition(R.anim.slide_in, R.anim.slide_out); super.onCreate(savedInstanceState); setContentView(R.layout.layout_home); adView = (AdView) this.findViewById(R.id.adView); AdRequest adRequest = new AdRequest.Builder().build(); adView.loadAd(adRequest); btn_subscription = (Button) findViewById(R.id.btn_subscription); btn_subscription.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { vibrateButton(v); } }); } public void vibrateButton(View v) { buttonVibrate = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); buttonVibrate.vibrate(30); } } 
+3
source share
1 answer

Wrap LinearLayout inside another RelativeLayout . Thus, the addition of LinearLayout will not reduce the available space for the banner.

See an example:

 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:ads="http://schemas.android.com/apk/res-auto" android:id="@+id/mainLayout" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <LinearLayout //copy paste your linear layout code here (without AdView).. ... </LinearLayout> <com.google.android.gms.ads.AdView android:id="@+id/adView" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_alignParentBottom="true" ads:adSize="SMART_BANNER" ads:adUnitId="@string/adMob_ID" /> </RelativeLayout> 

Pay attention to android:layout_alignParentBottom="true" , which aligns the AdView at the bottom

+1
source

All Articles