Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/200.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 为什么我看不见我的间隙?_Android_Ads - Fatal编程技术网

Android 为什么我看不见我的间隙?

Android 为什么我看不见我的间隙?,android,ads,Android,Ads,我正在尝试用hello world节目制作中间广告和横幅广告 横幅添加工作正常,但当我在emulator上打开我的decive时,Intercentralad没有出现 这是我的密码: Androidmainfaist: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.za

我正在尝试用hello world节目制作中间广告和横幅广告 横幅添加工作正常,但当我在emulator上打开我的decive时,Intercentralad没有出现

这是我的密码:

Androidmainfaist:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.zaki.adstrial" >

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >

    <meta-data android:name="com.google.android.gms.version"
        android:value="@integer/google_play_services_version" />

    <activity
        android:name=".MainActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>


    <activity android:name="com.google.android.gms.ads.AdActivity"
              android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
        android:theme="@android:style/Theme.Translucent"/>


</application>

</manifest>
activitymain.xml:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:ads="http://schemas.android.com/apk/res-auto"

android:layout_width="match_parent"
android:layout_height="match_parent"   android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity">

<TextView android:text="@string/hello_world"      android:layout_width="wrap_content"
    android:layout_height="wrap_content" />

<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>


</RelativeLayout>

问题在哪里
提前感谢

您已经正确设置了
Interstitalad
,但您没有加载任何内容。您的
adRequest2
仅加载横幅广告的数据,即
mAdView

也就是说,你似乎也正确地为你的间隙设置了另一个
AdRequest
;你可能只是忘记加载了。因此,您只需调用以下代码:

mInterstitialAd.loadAd(adRequest);

我想你刚刚忘了装插页广告

以前

    AdRequest adRequest = new AdRequest.Builder().addTestDevice(
            AdRequest.DEVICE_ID_EMULATOR).build();
之后

    AdRequest adRequest = new AdRequest.Builder().addTestDevice(
            AdRequest.DEVICE_ID_EMULATOR).build();
AdRequest adRequest = new AdRequest.Builder().addTestDevice(
            AdRequest.DEVICE_ID_EMULATOR).build();
    mInterstitialAd.loadAd(adRequest);