Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to put an ad at the bottom of a layout
    primarykey
    data
    text
    <p>i want my admob ad to came up at the bottom of my layout and but it shows up just below the my buttons. i need it to be away from the buttons do i need to use a relativelayout or i can use a linearlayout any ideas on how i can do this thanks in advance. </p> <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads" android:id="@+id/mainLay" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" tools:context=".Main" &gt; &lt;!-- this is a lable to tell the user to input the recipients number in the input box below --&gt; &lt;TextView android:id="@+id/tvNumber" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/number" /&gt; &lt;!-- this is were the user enters the number of the message recipient --&gt; &lt;EditText android:id="@+id/etRecipient" android:layout_width="fill_parent" android:layout_height="wrap_content" android:hint="@string/enter_recioient" android:inputType="number" /&gt; &lt;!-- tihs is an instraction lable --&gt; &lt;TextView android:id="@+id/tvProvider" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/provider" /&gt; &lt;!-- this is a dropdown(spinner) where the user selects the provider --&gt; &lt;Spinner android:id="@+id/spProvider_list" android:layout_width="match_parent" android:layout_height="wrap_content" android:prompt="@string/provider_prompt" /&gt; &lt;TextView android:id="@+id/tvMessage" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/massage" /&gt; &lt;EditText android:id="@+id/etMassage" android:layout_width="fill_parent" android:layout_height="wrap_content" android:hint="@string/type_message" /&gt; &lt;LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:padding="10dp" android:weightSum="100" &gt; &lt;Button android:id="@+id/btnSend" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="50" android:text="@string/send" /&gt; &lt;Button android:id="@+id/btnCancel" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="50" android:text="@string/cancel" /&gt; &lt;/LinearLayout&gt; &lt;/LinearLayout&gt; </code></pre> <p>the java for the ad is here</p> <pre><code>LinearLayout lay = (LinearLayout) findViewById(R.id.mainLay); AdView adView = new AdView(this, AdSize.SMART_BANNER, pubId); lay.addView(adView); AdRequest adRequest = new AdRequest(); adRequest.addTestDevice(AdRequest.TEST_EMULATOR); adView.loadAd(adRequest); </code></pre> <p>this is the updated xml</p> <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads" android:id="@+id/mainLay" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" tools:context=".Main" &gt; &lt;!-- this is a lable to tell the user to input the recipients number in the input box below --&gt; &lt;TextView android:id="@+id/tvNumber" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/number" /&gt; &lt;!-- this is were the user enters the number of the message recipient --&gt; &lt;EditText android:id="@+id/etRecipient" android:layout_width="fill_parent" android:layout_height="wrap_content" android:hint="@string/enter_recioient" android:inputType="number" /&gt; &lt;!-- tihs is an instraction lable --&gt; &lt;TextView android:id="@+id/tvProvider" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/provider" /&gt; &lt;!-- this is a dropdown(spinner) where the usere selects the provider --&gt; &lt;Spinner android:id="@+id/spProvider_list" android:layout_width="match_parent" android:layout_height="wrap_content" android:prompt="@string/provider_prompt" /&gt; &lt;TextView android:id="@+id/tvMessage" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/massage" /&gt; &lt;EditText android:id="@+id/etMassage" android:layout_width="fill_parent" android:layout_height="wrap_content" android:hint="@string/type_message" /&gt; &lt;LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:weightSum="100" &gt; &lt;Button android:id="@+id/btnSend" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="50" android:text="@string/send" /&gt; &lt;Button android:id="@+id/btnCancel" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="50" android:text="@string/cancel" /&gt; &lt;com.google.ads.AdView android:id="@+id/ads" android:layout_width="wrap_content" android:layout_height="wrap_content" ads:adUnitId = "**************" ads:adSize = "BANNER" /&gt; &lt;/LinearLayout&gt; &lt;/LinearLayout&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload