安卓:Flurry广告横幅占满整个屏幕

3

我正在为我的应用程序实现Flurry横幅广告。但是它会占据全屏。我的主要activity.xml文件如下:

<?xml version="1.0" encoding="UTF-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/background"
android:orientation="vertical" >

<FrameLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:id="@+id/bannerframe" >
</FrameLayout>

<SeekBar
    android:id="@+id/volumeBar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_margin="5dp" />

<android.support.v4.view.ViewPager
    android:id="@+id/pager"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />

 </LinearLayout>

在Java中,我正在编写以下代码。

FrameLayout fViewGroup = (FrameLayout)findViewById(R.id.bannerframe);
FlurryAgent.onStartSession(appContext, "My API Key is here");
FlurryAgent.initializeAds(appContext);
FlurryAgent.getAd(appContext, "Deer Hunting Calls",fViewGroup,FlurryAdSize.BANNER_TOP, 0);

以下是我收到的屏幕截图。 在此输入图像描述 有人知道为什么add占据了整个屏幕吗? 我已经尝试了android:layout_width和height的所有选项,包括fill_parent、warp_content、match_parent等,但仍然得到相同的结果。

我在iOS上遇到了同样的问题,但只有在广告被点击后才出现。 - R T
1个回答

2
问题已解决。我使用了dp单位的宽度和高度...以下是使用的标签..
 <FrameLayout
        android:id="@+id/flurryBanner"
        android:layout_width="320dp"
        android:layout_height="50dp"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true" >
  </FrameLayout>

代码示例:

FrameLayout flurryBanner;
flurryBanner = (FrameLayout) findViewById(R.id.flurryBanner);
FlurryAgent.initializeAds(appContext);
FlurryAgent.getAd(appContext, "My App",flurryBanner,FlurryAdSize.BANNER_TOP, 0);

工作得很棒...


为什么不使用FlurryAdSize.BANNER_BOTTOM? - Will Kru
FlurryAdSize.BANNER_BOTTOM和FlurryAdSize.BANNER_TOP存在同样的问题。 - Ahmed Nawaz

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接