0
如何將AdView(AdMob)廣告推送到Android Activity的頁面底部?這裏是我的activity_main.xml佈局的代碼。出於某種原因,它不會與底部對齊。我試圖把AdView裏面無法工作。任何幫助讚賞。如何在Android應用中將AdView推送到頁面底部
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:id="@+id/linearLayout_main"
xmlns:ads="http://schemas.android.com/apk/res-auto"
tools:context=".MainActivity">
<!--custome toolbar-->
<include layout="@layout/tool_bar" />
<!--Wifi name and state-->
<LinearLayout
android:id="@+id/linear_wifi_name"
android:layout_width="match_parent"
android:layout_height="40dp"
android:orientation="horizontal">
<ImageView
android:id="@+id/wifi_icon_id"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.20" />
<TextView
android:id="@+id/wifi_name"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.60"
android:textSize="20dp"
android:gravity="center"
android:textAlignment="center" />
<ImageView
android:id="@+id/scan_icon"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.20"
android:src="@drawable/ic_keyboard_arrow_right_white_36dp"/>
</LinearLayout>
<!--Progess bar-->
<ProgressBar
style="@android:style/Widget.DeviceDefault.Light.ProgressBar.Horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="visible"
android:id="@+id/progress_bar" />
<!--this section is for wifi/private network-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="5dp">
<TextView
android:id="@+id/result_local"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:typeface="monospace"
android:text="Local Network:"
android:textColor="@color/colorAccent"
android:textSize="20dp"/>
<TextView
android:id="@+id/private_net_info"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:typeface="monospace"
android:textSize="16dp"/>
</LinearLayout>
<!--this section is for public ip info-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="5dp">
<TextView
android:id="@+id/result_public"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:typeface="monospace"
android:textColor="@color/colorAccent"
android:text="Public Ip:"
android:textSize="20dp"/>
<TextView
android:id="@+id/public_net_info"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:typeface="monospace"
android:textSize="16dp"/>
</LinearLayout>
<!-- banner ads for AdsMob-->
<com.google.android.gms.ads.AdView
android:id="@+id/adView_main"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
android:layout_gravity="bottom"
ads:adSize="BANNER"
ads:adUnitId="ca-app-pub-3940256099942544/6300978111"
android:padding="5dp">
</com.google.android.gms.ads.AdView>
</LinearLayout>
謝謝...太多了! – miatech