android - 如果代码需要,则不会显示 tapfortap 横幅

标签 android adview

如果我把它放在我的 Activity 布局中,那么横幅显示就没有问题

<com.tapfortap.AdView android:id="@+id/ad_view"
  android:layout_height="50dip"
  android:layout_width="320dip"
  android:layout_gravity="bottom"
  />

但是我在代码中这样做我的横幅没有显示

AdView adView = new AdView(this);
// Optionally specify layout params.
DisplayMetrics metrics = getResources().getDisplayMetrics();
int width = metrics.widthPixels;
int height = (int)(50 * (width / 320.0));
LinearLayout.LayoutParams myLayoutParams = new LinearLayout.LayoutParams(width, height);
adView.setLayoutParams(myLayoutParams);
// Add the AdView to your layout.
myLayout.addView(adView);

问题是

10-19 13:04:02.066 W/com.tapfortap.AdView(15940): Unable to display ads, not enough space.

我不明白,因为 mylayout 在我创建的这个示例应用程序中有足够的空间,是整个屏幕中唯一的一个

最佳答案

使用 padding 时会出现问题,即使它只是顶部填充并且有很多空间......

也许下一个版本的 tapfortap sdk 会解决这个问题

关于android - 如果代码需要,则不会显示 tapfortap 横幅,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12972954/

相关文章:

javascript - 错误 : 180: EXCEPTION thrown ('dev!' ): - and ERROR:> aqsrv> 70: Exception caught in (null) - Error -1

android - 如何在 React Native 中为 IOS 和 Android 缓存图像?

android - 字符串最多换行的 TextView

android - 在哪里放置静态 URL 在 android 项目中?

android - Adview loadAd() 触发 StrictMode 违规

android - AdView 实例化失败

Android:点击时需要Mopub广告在WebView中打开

android - 在新 Intent 中显示 TabHost 布局的问题

java - adView 在换行内容中不可见

android - AdSize.BANNER 的大小(以像素为单位)是多少?