android - Adwhirl + Millenial Media 广告尺寸 - 太长

标签 android admob ads adwhirl

我在 Adwhirl 中展示广告时遇到一些问题。

我在那里展示 Millenial Media 和 Admob 广告。

Admob 看起来不错,但是当加载 MM 广告时,它看起来太长了。

我试图以某些方式修复它,但无法修复它。

这是我的 Adwhirl Java 代码:

LinearLayout layout = (LinearLayout) findViewById(R.id.layout_main);

AdWhirlLayout adWhirlLayout = new AdWhirlLayout(this, "apid");
RelativeLayout.LayoutParams adWhirlLayoutParams = 
                 new RelativeLayout.LayoutParams(
                        LayoutParams.FILL_PARENT,
                        LayoutParams.WRAP_CONTENT);
int diWidth = 320;
int diHeight = 53;

float density = getResources().getDisplayMetrics().density;

adWhirlLayout.setMaxWidth((int)(diWidth * density + 0.5f));
adWhirlLayout.setMaxHeight((int)(diHeight * density + 0.5f));

layout.addView(adWhirlLayout, adWhirlLayoutParams);
layout.invalidate();

如果有人知道如何修复它,请帮忙。

编辑:

我正在研究 HTC Desire,也尝试在 xml 中创建 adwhirl 布局,但仍然是同样的问题;(

我尝试将 MM Layout 添加到 xml 并使用参数 app:width="320"它看起来不错。默认值为 480,使用此值,广告看起来类似于 adwhirl 实现(太长)

xmlns:app="http://millennialmedia.com/android/schema"

<com.millennialmedia.android.MMAdView
android:id="@+id/mmadview" 
android:layout_width="fill_parent" 
android:layout_height="wrap_content"
app:apid="28911"
app:adType="MMBannerAdTop"
app:refreshInterval="30"
app:accelerate="true"
app:ignoreDensityScaling="false"
app:age="46"
app:gender="female"
app:zip="90210"
app:income="85000"
app:keywords="moms,shopping,groceries"
app:ethnicity="hispanic"
app:orientation="straight"
app:marital="married"
app:children="2"
app:education="college"
app:politics="libertarian"
app:height="60"
app:width="480" /> <------------------------------------HERE 

也许可以在 adwhirl 布局中设置这个值?

编辑 2:

看起来 480x800 设备分辨率有问题。我在 QVGA 320x240 模拟器上调试了应用程序,广告看起来很漂亮。

编辑 3:

链接中的图像看起来像:Too long MM ad in Adwhirl Layout

当广告出现时,我可以看到水平滚动条,我认为我只能看到这些广告的 2/3

最佳答案

我想知道尝试计算宽度和高度是否有问题。试试这个基本 fragment :

LinearLayout layout = (LinearLayout) findViewById(R.id.layout_main);
AdWhirlLayout adWhirlLayout = new AdWhirlLayout(this, "apid");
layout.addView(adWhirlLayout);

更新:

您还可以通过 XML 创建 AdWhirlLayout。

<com.adwhirl.AdWhirlLayout
    android:id="@+id/adwhirl_layout"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"/>

AdWhirl 通过查看此代码段的 list 获取您的 SDK key :

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

更新 2:

所以根据Millennial documentation ,建议不设置高宽,让SDK根据设备进行优化。 HTC Desire 的屏幕密度为 1.5,因此 320x53 的广告应该放大到 480x79.5 之类的尺寸。这解释了为什么 480 是默认值。我仍然不确定为什么它太长了。它应该非常适合。当您说太长时,是只长了几个像素还是太长了 1.5 倍?

更新 3:

所以我实际上能够重现这个问题,这看起来像是 Millennial 端的一个错误。我不确定它是否只是创意,因为我只能得到那个确切的广告,但那个广告绝对是 480dp 宽,而它应该只有 480px 宽。如果您将设备置于横向模式,您可以看到它有多大。

我建议联系 Millennial,询问他们以前是否遇到过这个问题。

关于android - Adwhirl + Millenial Media 广告尺寸 - 太长,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8834183/

相关文章:

android - 在 Android 的 ActionBar 中显示图标和标题

android - 如何在Android中获取库的包名?

android - 无法在 Android 应用程序中显示 Mopub 的原生广告

java - 横幅广告导致 Android 应用程序崩溃

android - android sqlite数据库中rawquery和execSQL的区别

android - 改造:偶尔获取 java.util.NoSuchElementException

android - 开始使用 Android 游戏和 AdMob

android - Admob 在 Android 应用程序中导致 NullPointerException

android - float 操作按钮下的 Admob

android - Supersonic ADS 和 Xamarin 之间的集成