1

AdWhirlをアプリに統合しました。メインアクティビティのレイアウトの下部に表示されるようにAdWhirlビューを設定しています。メインレイアウトにいくつかのEditTextボックスがあり、アプリが最初に起動したときにテキストボックスをクリックすると、通常どおりソフトキーボードが表示されます。ただし、別のアクティビティに移動してメインアクティビティに戻ると、EditTextをクリックすると、ソフトキーボードがポップアップし、上部にAdWhirlビューが表示され、EditTextボックスが覆われます。私はこれに何日も苦労してきました。どんな助けでもいただければ幸いです。

すべてのアクティビティのマニフェストにandroid:windowSoftInputMode="adjustPan"が定義されています。

これが私のmain.xmlレイアウトです:

<RelativeLayout android:id="@+id/RelativeLayout01"
android:layout_width="fill_parent" android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android">

<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" 
    android:paddingBottom="30dip"/>

<TableLayout xmlns:android="http://schemas.android.com/apk/res/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
</TableLayout>

<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"/>

</LinearLayout>

 </RelativeLayout>
4

2 に答える 2

2

onFocusChangeListenerをEditTextボックスに設定してみてください。それらがフォーカスを取得したら、AdWhirlビューの可視性をView.INVISIBLEに設定して、テキストボックスを遮らないようにし、フォーカスが失われたときに表示に戻します。

final AdWhirl ad = (AdWhirl)findViewById(R.id.adwhirlAd);
        EditText et = (EditText)findViewById(R.id.editTextBox);
        et.setOnFocusChangeListener(new OnFocusChangeListener() {

            @Override
            public void onFocusChange(View v, boolean hasFocus) {

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

            }
        });
于 2011-04-19T05:06:33.370 に答える
0

android:windowSoftInputMode="adjustPan"を設定してみました。adMobバナーだけでなく、EdiTextも非表示にします。受け入れられた答えも試しましたが、キーボードを開かなくてもエディットテキストにフォーカスを合わせることができます。だから私が見つけた解決策は、キーボードが開いたときにadMobバナーを非表示にすることです。ここでキーボードが開いているかどうかを検出する方法を学びました。そしてここに私の解決策があります:

final View activityRootView = findViewById(R.id.sample_main_layout);
            activityRootView.getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
                @Override
                public void onGlobalLayout() {
                    int heightDiff = activityRootView.getRootView().getHeight() - activityRootView.getHeight();
                    if (heightDiff > Support.dpToPx(MainActivity.this, 200)) { // if more than 200 dp, it's probably a keyboard...
                        mAdView.setVisibility(View.GONE);
                    }
                    else{
                        mAdView.setVisibility(View.VISIBLE);
                    }
                 }
            });
于 2016-11-06T11:35:13.173 に答える