不显示admob横幅,仅显示为白色

时间:2017-04-12 01:38:23

标签: android admob android-cardview adbannerview banner-ads

大家好,我正在使用一个admob横幅,因为我正在阅读我,我按照这些教程,尝试了两种方法 1.-我把正常形式的adomob放在清单等布局中的参数之后 2.-另一种方式是放置手机的ID,因为我的应用程序还没有找到Playstore,但是它对我不起作用,它显示在populateviewholder中以显示在回收站视图中

xml:

 <LinearLayout android:orientation="vertical"
android:layout_marginTop="55dp"
android:layout_height="match_parent"
android:layout_width="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto">


<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:cardCornerRadius="0dp"
    android:elevation="20dp"
    android:id="@+id/cardView2">

    <include layout="@layout/layout_post"/>


</android.support.v7.widget.CardView>

<android.support.v7.widget.CardView
    android:id="@+id/cardView"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:elevation="20dp"
    app:cardCornerRadius="0dp">

    <ImageView
            android:id="@+id/iv_post_display"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:adjustViewBounds="true"
            android:src="@drawable/imageholder" />

</android.support.v7.widget.CardView>

<android.support.v7.widget.CardView
    android:layout_marginTop="6dp"
    android:layout_gravity="center"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content">

    <com.google.android.gms.ads.AdView
        xmlns:ads="http://schemas.android.com/apk/res-auto"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        ads:adSize="BANNER"
        ads:adUnitId="@string/id_anuncio"
        android:id="@+id/adViewRanEspanol">

    </com.google.android.gms.ads.AdView>

</android.support.v7.widget.CardView>

包含AdView的cardview,消失...

相关代码

   protected void populateViewHolder(final PostHolder viewHolder, final Post model, int position) {
            Post mPost = new Post();

            viewHolder.mAdView = new AdView(getActivity());
            AdRequest adRequest = new AdRequest.Builder().addTestDevice(AdRequest.DEVICE_ID_EMULATOR).addTestDevice("7775AC7DC1AC628EBAFF1EB0CBF0A4B3").build();
            viewHolder.mAdView.setAdSize(AdSize.BANNER);
            viewHolder.mAdView.setAdUnitId("ca-app-pub-1291200089622969/xxxxx"rest of string" ");
            viewHolder.mAdView.loadAd(adRequest);

清单:

 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.octa.memetixs">

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

<application
    android:name=".PostApplication"
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher_definitivo"
    android:label="Post it!"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">
    <activity android:name=".Activities.Log_Reg_Forgot.LogInActivity">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity android:name=".Activities.Log_Reg_Forgot.RegisterActivity" />
    <activity android:name=".Activities.Log_Reg_Forgot.ForgotActivity" />
    <activity
        android:name=".Activities.main.main_spanish.random.PostActivity"
        android:label="@string/title_activity_post"
        android:theme="@style/AppTheme" />
    <activity android:name=".Activities.misc.OptionActivity" />
    <activity android:name=".Activities.main.main_spanish.random.CommentActivity"></activity>
    <activity android:name=".Activities.main.main_spanish.random.CommentVideoActivity" />


    <activity android:name=".Activities.main.main_english.randomactivitys.PostActivityEng"></activity>
    <activity android:name=".Activities.main.main_english.randomactivitys.CommentActivityEng"></activity>
    <activity android:name=".Activities.main.main_english.randomactivitys.CommentVideoActivityEng"></activity>


    <activity android:name=".Activities.main.main_spanish.memetc.PostActivityMemes"></activity>
    <activity android:name=".Activities.main.main_spanish.memetc.CommentActivityMemes"></activity>
    <activity android:name=".Activities.main.main_spanish.memetc.CommentVideoActivityMemes"></activity>


    <activity android:name=".Activities.main.main_english.memeactivitys.CommentActivityEngMeme"></activity>
    <activity android:name=".Activities.main.main_english.memeactivitys.CommentVideoActivityEngMeme"></activity>
    <activity android:name=".Activities.main.main_english.memeactivitys.PostActivityEngMeme"></activity>


    <activity android:name=".Activities.main.main_spanish.creativo.CommentActivityCreativo"></activity>
    <activity android:name=".Activities.main.main_spanish.creativo.CommentVideoActivityCreativo"></activity>
    <activity android:name=".Activities.main.main_spanish.creativo.PostActivityCreativo"></activity>


    <activity android:name=".Activities.main.main_english.creativeactivities.CommentActivityEngCreative"></activity>
    <activity android:name=".Activities.main.main_english.creativeactivities.CommentVideoActivityEngCreative"></activity>
    <activity android:name=".Activities.main.main_english.creativeactivities.PostActivityEngCreative"></activity>

    <activity android:name=".Activities.main.main_universals.mainWtf.PostActivityWtf"></activity>
    <activity android:name=".Activities.main.main_universals.mainWtf.CommentActivityWtf"></activity>
    <activity android:name=".Activities.main.main_universals.mainWtf.CommentVideoActivityWtf"></activity>

    <activity android:name=".Activities.main.main_universals.mainAdu.CommentVideoActivityAdu"></activity>
    <activity android:name=".Activities.main.main_universals.mainAdu.PostActivityAdu"></activity>
    <activity android:name=".Activities.main.main_universals.mainAdu.CommentActivityAdu"></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>

0 个答案:

没有答案