Android上的空的AdWhirl布局(没有显示广告)布局、广告、Android、AdWhirl

2023-09-06 05:17:22 作者:是俄的错让你沉沦

我有一个整合的AdWhirl到我的Andr​​oid应用程序一个奇怪的问题。

I have a strange problem with integrating AdWhirl into my android app.

通过连接的AdWhirl网络:结果* Mileniall媒体结果* AdMob的结果*的InMobi(它使无效适配器错误但那是一个已知的问题,而不是主要问题)

Networks connected through AdWhirl: * Mileniall Media * AdMob * InMobi (it gives invalid adapter error but thats a known issue and not the main problem)

我downoaded并列入的AdWhirl SDK 3.0.0,为各自网络的罐子,做了所有包含在手册中的步骤(清单文件的变化,包括LIB等)

I've downoaded and included AdWhirl SDK 3.0.0, the jars for respective network and did all the steps included in the manual (changes in manifest file, lib including etc)

和我已经把AdWhirl中的code到我的应用程序。

And I've put the AdWhirl code into my app.

布局是AdWhirlLayout占位符。

Layout that is the placeholder for AdWhirlLayout.

<LinearLayout
        android:id="@+id/ads"
        android:layout_width="fill_parent"
        android:layout_height="52dip"
        android:layout_weight="0"
        android:background="#0f0"/>

code的广告布局:

Code for ads layout:

adLayout = (LinearLayout) findViewById(R.id.ads);
AdWhirlLayout adWhirlLayout = new AdWhirlLayout(this, "ad whirl code");
RelativeLayout.LayoutParams adWhirlLayoutParams = new RelativeLayout.LayoutParams(UIUtils.dip(320), UIUtils.dip(52));
adWhirlLayout.setBackgroundColor(Color.DKGRAY);
adLayout.addView(adWhirlLayout, adWhirlLayoutParams);
adLayout.invalidate();

我可以看到,无论是布局的显示(由于他们有颜色)。

I can see that both of the layouts are shown (due to the color that they have).

我也知道,网络连接是否正确,因为我可以看到,在logcat中

I also know that the networks are connected correctly because I can see that in logcat

05-11 15:11:52.279: DEBUG/AdWhirl SDK(8013): Showing ad:
05-11 15:11:52.279: DEBUG/AdWhirl SDK(8013):     nid: d10c4fe5e08f469ca1992bfe277902f5
05-11 15:11:52.279: DEBUG/AdWhirl SDK(8013):     name: millennial
05-11 15:11:52.279: DEBUG/AdWhirl SDK(8013):     type: 6
05-11 15:11:52.279: DEBUG/AdWhirl SDK(8013):     key: XXXXX
05-11 15:11:52.279: DEBUG/AdWhirl SDK(8013):     key2: 
05-11 15:11:52.279: DEBUG/AdWhirl SDK(8013): Valid adapter, calling handle()

和在网络站点上 - 我看到有广告请求

and on the network sites - I see the ad request there.

但布局保持灰色,不管是什么。我很疑惑。

But the layout stays gray, no matter what. I'm puzzled.

推荐答案

有关的AdWhirl的文档是pretty可怕。试试这个吹大的AdWhirl布局更简单的方式:

The documentation for AdWhirl is pretty horrible. Try this much simpler way to inflate the AdWhirl layout:

而不是通过$ C $创建布局c您可以简单地通过正常的XML布局文件创建的。不要使用的LinearLayout 像他们说明建议(我认为这是过时的)。而不是仅仅把这个元素在你的布局,无论你想的旗帜是:

Instead of creating the layout through code you can simply create it through your normal XML layout file. Don't use the LinearLayout like their instructions suggest (I think it's outdated). Instead just place this element in your layout wherever you want the banner to be:

    <com.adwhirl.AdWhirlLayout
         android:layout_width="fill_parent"
         android:layout_height="wrap_content" />

严重的是,就是这样。确保您的AdWhirl关键是在清单以及(或者在&LT;活性GT; &lt;应用&GT; 标签):

    <meta-data android:value="Your Key"
         android:name="ADWHIRL_KEY"/>

如果你真的需要做任何编程,你可以给布局的 ID 像往常一样,并使用 findViewById 。还是让我知道,如果这有助于。

If you really need to do anything programmatically you can give the layout an id as usual and use findViewById. Lemme know if this helps.