【问题标题】:How to get admob banner shown in bottom true如何让 admob 横幅显示在底部 true
【发布时间】:2017-08-15 02:44:09
【问题描述】:

我已经制作了一个应用,并且横幅可以正常工作,但我希望横幅位于底部。我已经尝试了很多,但我无法让它工作。希望有人可以在这里帮助我。

这是main.xml中的代码,目前广告显示在中心

<LinearLayout 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"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    android:orientation="vertical">




    <android.support.v7.widget.Toolbar
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@color/orange"
        android:id="@+id/toolbar"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
        app:title="Tanzverbot Soundboard" />

    <android.support.v4.widget.DrawerLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:layout_height="match_parent"
        android:layout_width="match_parent"
        android:id="@+id/drawerLayout"
        >

        <com.google.android.gms.ads.AdView
            android:id="@+id/adView"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerHorizontal="true"
            android:layout_alignParentBottom="true"
            ads:adSize="BANNER"
            ads:adUnitId="@string/banner_ad_unit_id">
        </com.google.android.gms.ads.AdView>

    <FrameLayout
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/containerView">


     </FrameLayout>



    <android.support.design.widget.NavigationView
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:id="@+id/shitstuff"
        app:itemTextColor="@color/black"
        app:menu="@menu/drawermenu"
        />



    </android.support.v4.widget.DrawerLayout>



    </LinearLayout>

【问题讨论】:

  • 需要一个屏幕截图来看看你的屏幕是什么样子的。
  • 您的问题是您使用的是android:layout_centerHorizontal="true"。摆脱这条线,这应该适合你
  • 哦,是的,非常感谢
  • 我把它作为一个问题发布,所以如果你能接受它作为答案,当人们遇到困难时会有所帮助

标签: android xml layout admob banner


【解决方案1】:

您的问题是您使用的是android:layout_centerHorizontal="true"。摆脱这条线,这应该适合你。

希望这会有所帮助!

【讨论】:

    猜你喜欢
    • 2018-07-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-03-29
    • 1970-01-01
    相关资源
    最近更新 更多