Jeremy Henderson Jeremy Henderson - 3 months ago 31
Android Question

Adview displaying on top of soft keyboard

I have just integrated AdWhirl into my app. I have the AdWhirl view set to show up on the bottom of the layout of my main activity. I have a few EditText boxes on my main layout and when the app first launches clicking the text boxes displays the soft keyboard normally. However when I go to another activity and back to my main activity, then click the EditText the soft keyboard pops up with the AdWhirl view on top, covering my EditText box. I have been struggling with this for days. Any help would be appreciated.

I have android:windowSoftInputMode="adjustPan" defined in my manifest for all activities.

Here is my main.xml layout:

<RelativeLayout android:id="@+id/RelativeLayout01"
android:layout_width="fill_parent" android:layout_height="fill_parent"

<ImageView android:id="@+id/ImageView02"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:background="@drawable/other_bg_small" android:layout_weight="1"/>

<ImageView android:id="@+id/ImageView01"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:background="@drawable/banner" android:layout_alignParentTop="true"

<TableLayout xmlns:android=""
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:stretchColumns="1" android:gravity="center" android:id="@+id/table01"
android:layout_below="@id/ImageView01" >

... Table stuff

<LinearLayout android:layout_width="fill_parent"
android:id="@+id/ad_layout" android:layout_height="wrap_content"
android:gravity="bottom" android:layout_alignParentBottom="true"
android:layout_alignBottom="@+id/RelativeLayout01" android:layout_weight="1">

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



Joe Joe

Try setting a onFocusChangeListener to your EditText boxes. When they get focus, set the AdWhirl view visibility to View.INVISIBLE so it doesn't obstruct the textboxes and then set it back to visible once focus is lost.

final AdWhirl ad = (AdWhirl)findViewById(;
        EditText et = (EditText)findViewById(;
        et.setOnFocusChangeListener(new OnFocusChangeListener() {

            public void onFocusChange(View v, boolean hasFocus) {

                ad.setVisibility(hasFocus ? View.INVISIBLE : View.VISIBLE);