0

I have an activity which has an edite text and a button, following the concept format below


[EDITE TEXT] [BUTTON]

[ADVERT]


My problem is, when my keyboard opens in landscape view ( soft keyboard ) after touching the edit text to obviously input something, the ad dissapears. The keyboard seems to come in contact with the ad (visually) and for some reason it removes the ad and pushes the activity up abit (normal besides removing the ad).

Any idea how i could either fix this issue, or where i could detect when the keyboard is closed the ad can be reloaded ??

asd2005
  • 285
  • 2
  • 5
  • 11
  • you can check if keyboard shown using this example http://stackoverflow.com/questions/2150078/android-is-software-keyboard-shown – Ahmed Salem Oct 16 '11 at 09:19

2 Answers2

3

You should put your AdView as direct child of RootView of the layout.

<LinearLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"

  android:layout_width="match_parent"
  android:layout_height="match_parent">
<LinearLayout/><!-- Your Layout--></LinearLayout>
<com.google.ads.AdView 
   android:layout_height="wrap_content" 
   android:layout_width="wrap_content"
   android:id="@+id/adView" 
   ads:adSize="BANNER"
   ads:loadAdOnCreate="true"/>

</LinearLayout>
1

Add this to your activity declaration in the AndroidManifest.xml:

android:configChanges="orientation|keyboardHidden"

And add this to your activity class:

public void onConfigurationChanged(Configuration newConfig)
{
    super.onConfigurationChanged(newConfig);
}
IncrediApp
  • 10,083
  • 2
  • 29
  • 24