Ahmed Nawaz
Ahmed Nawaz

Reputation: 1644

android: Flurry Ads Banner taking Full screen

I am implementing flurry banner ads in my app. But it takes full screen. My main activity.xml is

<?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>

and in java i am doing this code.

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);

following is the screen shot i am getting. enter image description here

anyone know why add is getting full screen??? I have tried all options in android:layout_width and height with fill_parent, warp_content, match_parent etc. but still get the same results.

Upvotes: 3

Views: 1887

Answers (1)

Ahmed Nawaz
Ahmed Nawaz

Reputation: 1644

Problem Solved. I used width and height in dp... following is the used tag..

 <FrameLayout
        android:id="@+id/flurryBanner"
        android:layout_width="320dp"
        android:layout_height="50dp"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true" >
  </FrameLayout>

Code like:

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

Working Awesome...

Upvotes: 2

Related Questions