3

アプリに派手なバナー広告を実装しています。ただし、フルスクリーンが必要です。私の主な 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 などで試しましたが、それでも同じ結果が得られます。

4

1 に答える 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);

素晴らしい作業...

于 2012-11-19T11:18:33.303 に答える