android - How to add AdMob under floating action button -
i have problem position of floatingactionbutton
. when put ad admob
, want put ad under fab button method try not work.
image of current postion:
main_activity:
<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:ads="http://schemas.android.com/apk/res-auto" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingbottom="@dimen/activity_vertical_margin" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" android:cliptopadding="false"> <com.google.android.gms.ads.adview android:id="@+id/adview" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_centerhorizontal="true" android:layout_alignparentbottom="true" ads:adsize="banner" ads:adunitid="@string/banner_home_footer"> </com.google.android.gms.ads.adview> <android.support.v7.widget.recyclerview android:id="@+id/notes_recycler_view" android:scrollbars="vertical" android:layout_alignparenttop="true" android:layout_alignparentleft="true" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingbottom="80dp" android:cliptopadding="false"/> <textview android:id="@+id/empty_text_view" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center" android:visibility="gone" android:text="@string/no_notes"/> <android.support.design.widget.floatingactionbutton android:id="@+id/add_button" android:src="@drawable/add" android:layout_alignparentbottom="true" android:layout_alignparentright="true" android:layout_width="wrap_content" android:layout_height="wrap_content" app:backgroundtint="#e10000" app:fabsize="normal" app:borderwidth="0dp" app:elevation="6dp" app:pressedtranslationz="12dp" android:onclick="addnote"/> </relativelayout>
use layout_above attribute
<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:ads="http://schemas.android.com/apk/res-auto" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingbottom="@dimen/activity_vertical_margin" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" android:cliptopadding="false"> <android.support.design.widget.floatingactionbutton android:id="@+id/add_button" android:src="@drawable/add" <!--removed --> android:layout_alignparentright="true" android:layout_width="wrap_content" android:layout_height="wrap_content" app:backgroundtint="#e10000" app:fabsize="normal" app:borderwidth="0dp" app:elevation="6dp" app:pressedtranslationz="12dp" android:onclick="addnote" <!--added--> android:layout_above="@+id/adview" /> <com.google.android.gms.ads.adview android:id="@+id/adview" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_centerhorizontal="true" android:layout_alignparentbottom="true" ads:adsize="banner" ads:adunitid="@string/banner_home_footer"> </com.google.android.gms.ads.adview> <android.support.v7.widget.recyclerview android:id="@+id/notes_recycler_view" android:scrollbars="vertical" android:layout_alignparenttop="true" android:layout_alignparentleft="true" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingbottom="80dp" android:cliptopadding="false"/> <textview android:id="@+id/empty_text_view" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center" android:visibility="gone" android:text="@string/no_notes"/> </relativelayout>
Comments
Post a Comment