有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java AdMob智能旗帜问题

我的应用程序底部有一个SMART_横幅

SMART_横幅以以下方式在布局XML中声明:

<RelativeLayout xmlns:安卓="http://schemas.安卓.com/apk/res/安卓"
xmlns:tools="http://schemas.安卓.com/tools"
xmlns:app="http://schemas.安卓.com/apk/res-auto"
安卓:id="@+id/mainLayout"
安卓:layout_width="wrap_content"
安卓:layout_height="wrap_content"
安卓:orientation="vertical"
tools:context=".MainActivity" >

<WebView
    安卓:id="@+id/webview"
    安卓:layout_width="match_parent"
    安卓:layout_height="match_parent" />

<com.google.安卓.gms.ads.AdView
    xmlns:ads="http://schemas.安卓.com/apk/res-auto"
    安卓:id="@+id/adView"
    安卓:layout_width="match_parent"
    安卓:layout_height="wrap_content"
    安卓:layout_alignParentBottom="true"
    app:adSize="SMART_BANNER"
    app:adUnitId="ca-app-pub-xxxxxxxxx" /> </RelativeLayout>

我的AndroidManifest有以下内容:

 <activity 安卓:name="com.google.安卓.gms.ads.AdActivity"
        安卓:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />

ads在onCreate中以以下方式初始化:

if (Build.VERSION.SDK_INT > Build.VERSION_CODES.FROYO) {

        AdView adView = (AdView)this.findViewById(R.id.adView);
        AdRequest adRequest = new AdRequest.Builder()
            .addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
            .addTestDevice("TEST_DEVICE_ID")
            .build();
        adView.loadAd(adRequest);

        }

当应用程序以纵向模式启动时,将显示广告;当我将手机置于横向模式时,广告是按比例缩放的,不会填满所有可用空间。。。即使应用程序以横向模式启动,广告也会显示,但当我将手机置于纵向模式时,LogCat会显示:

Not enough space to show ad!

为什么??如何解决这些问题

对不起,我的英语不好, 提前谢谢


共 (0) 个答案