簡體   English   中英

Android廣告尺寸(智能橫幅並不總是有效)

[英]Android ad size (smart banner not always working)

我對adMob和他的banner尺寸有一個令人討厭的問題。 智能橫幅尺寸是一個非常好的東西,它幾乎可以為您做任何事情,與尺寸廣告有關,但只是差不多......

在谷歌文檔是一個表格,其中包括smartbanner支持的大小。 支持許多尺寸,但不支持普通Android手機的風景.. https://developers.google.com/mobile-ads-sdk/android-legacy/docs/admob/smart-banners

這就是現在的樣子:肖像 - 一切都很好

在此輸入圖像描述

風景 - 不工作

在此輸入圖像描述

那么有沒有辦法以正確的方式在橫向展示我的廣告? (這是針對ads:adSize="SMART_BANNER" ,當我使用ads:adSize="BANNER"它會顯示在兩者上但是它鎖定到ads:adSize="BANNER"的大小ads:adSize="BANNER"給你,所以它看起來很糟糕更大的屏幕)

XML

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:ads="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:background="@color/main_bg_color"
    android:id="@+id/rel_bg_home">

<LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        android:weightSum="1"
        android:layout_centerInParent="true"
        >

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Test"
            android:textSize="50sp"
            android:id="@+id/uber"
            android:shadowColor="#000000"
            android:shadowRadius="5"
            android:textStyle="bold"
            android:textColor="@color/text_color"
            android:layout_gravity="center_horizontal"
            android:layout_weight="0.20"
            android:gravity="center|bottom" />

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:layout_gravity="bottom|center_horizontal"
            android:layout_weight="0.30"
            android:gravity="bottom">

            <Button
                android:layout_width="90dp"
                android:layout_height="wrap_content"
                android:text="Play"
                android:id="@+id/play"
                android:textColor="@color/text_color"
                android:layout_marginBottom="20dp" />

            <Button
                android:layout_width="90dp"
                android:layout_height="wrap_content"
                android:text="Help"
                android:id="@+id/help"
                android:textColor="@color/text_color"
                android:layout_below="@+id/play"
                android:layout_marginBottom="20dp" />

            <Button
                android:layout_width="90dp"
                android:layout_height="wrap_content"
                android:text="Score"
                android:textColor="@color/text_color"
                android:id="@+id/score" />
        </LinearLayout>

    </LinearLayout>


    <ImageButton
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="@drawable/ic_action_achievement"
        android:layout_alignParentLeft="true"
        android:layout_alignBottom="@+id/toggle"
        android:layout_alignTop="@+id/toggle"
        android:layout_marginLeft="@dimen/activity_horizontal_margin"
        android:id="@+id/highscore"/>

    <ToggleButton
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/toggle"
        android:minHeight="10dp"
        android:minWidth="10dp"
        android:background="@drawable/check"
        android:layout_alignParentRight="true"
        android:focusable="false"
        android:focusableInTouchMode="false"
        android:textOn=""
        android:textOff=""
        android:layout_marginRight="@dimen/activity_horizontal_margin"
        android:layout_above="@+id/adView" />

    <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="SMART_BANNER"
        ads:adUnitId="@string/banner_ad_unit_id1">
    </com.google.android.gms.ads.AdView>
</RelativeLayout>

嘗試從xml文件中的父視圖中刪除任何marginpadding屬性。

希望這對你有所幫助。

有時,smart_banner無法在橫向模式下工作。 所以改變它的大小

廣告:adSize時= “大旗”

也許這個開源解決方案可以幫助您: https//github.com/ombori/app-banner

通過這個:

npm install --save app-banner


var appBanner = require('app-banner');
// - or -
import appBanner from 'app-banner';

appBanner.init({
 apple: 'id1234567890',
 google: 'com.youcompany.yourapp',
 placement: 'bottom-left',
})

或這個:

npm install --save app-banner


import AppBanner from 'app-banner/src';

...
<div>
<AppBanner google="com.youcompany.yourapp" apple="id1234567890" 
position="bottom-left" />
</div>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM