how to promote admob
-
I added Admob to it all works well, but how do we make the promotion more important so that the ad doesn't cut the buttons?
<RelativeLayout 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:id="@+id/main" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/back2" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context=".MainActivity">
<com.google.android.gms.ads.AdView android:id="@+id/banner" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_alignParentBottom="true" ads:adSize="SMART_BANNER" ads:adUnitId="@string/banner_ad_unit_id"> </com.google.android.gms.ads.AdView> <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent"> <TableLayout android:id="@+id/tableLayout" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_alignParentBottom="true" android:layout_alignParentLeft="true" android:layout_alignParentStart="true" android:layout_marginBottom="113dp" android:layout_toStartOf="@+id/button_reset" android:paddingLeft="10dp"> <TableRow android:layout_width="match_parent" android:layout_height="match_parent"> <EditText android:id="@+id/editText_DM" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_column="4" android:hint="@string/DM" android:inputType="phone" android:maxLength="3" android:textColorHint="@color/black" /> </TableRow> <TableRow android:layout_width="match_parent" android:layout_height="match_parent"> <EditText android:id="@+id/editText_MT" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_column="4" android:hint="@string/MT" android:inputType="phone" android:maxLength="3" android:textColorHint="@color/black" /> </TableRow> <TableRow android:layout_width="match_parent" android:layout_height="match_parent"> <EditText android:id="@+id/editText_MSDF" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_column="4" android:hint="@string/MSDF" android:inputType="phone" android:maxLength="3" android:textColorHint="@color/black" /> </TableRow> <TableRow android:layout_width="match_parent" android:layout_height="match_parent"> <EditText android:id="@+id/editText_IBSDF" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_column="4" android:hint="@string/IBSDF" android:inputType="phone" android:maxLength="3" android:textColorHint="@color/black" /> </TableRow> <TableRow android:layout_width="match_parent" android:layout_height="match_parent"> <EditText android:id="@+id/editText_Final" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_column="4" android:hint="@string/Final" android:inputType="phone" android:maxLength="3" android:textColorHint="@color/black" /> </TableRow> <TableRow android:layout_width="match_parent" android:layout_height="match_parent"> <EditText android:id="@+id/editText_AVG" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_column="4" android:hint="@string/AVG" android:inputType="phone" android:maxLength="9" android:textColorHint="@color/black" /> </TableRow> <TableRow android:layout_width="match_parent" android:layout_height="match_parent"> <EditText android:id="@+id/editText_U_need" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_column="4" android:hint="@string/U_need" android:inputType="phone" android:maxLength="12" android:textColorHint="@color/black" /> </TableRow> </TableLayout> <Button android:id="@+id/button_reset" style="?android:attr/buttonStyleSmall" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBottom="@+id/tableLayout" android:layout_alignParentEnd="true" android:layout_alignParentRight="true" android:layout_marginBottom="150dp" android:background="@drawable/ic_cached_black_36dp" android:paddingRight="5dp" android:text=" " /> </RelativeLayout>
</RelativeLayout>
-
To this end, the main screen and the promotion unit should be placed in one mark (e.g. RelativeLayout) and advertisements should be downstream of the main (attribut)
android:layout_above
with an equal id banner@id/adview
and get down to the bottom of the container.<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" >
<com.google.android.gms.ads.AdView android:id="@+id/adView" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" ads:adSize="SMART_BANNER" ads:adUnitId="@string/MAIN_AD_UNIT_ID"/> <Linearlayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_above="@id/adview"> ...тут основная разметка активити. </LinearLayout>
</RelativeLayout>