0

私のレイアウトでは、レイアウトにが表示されたAdMob広告がEditTextあります。編集テキストにフォーカスして何かを入力すると、キーボードが表示され、AdMob広告が編集テキスト上に移動し、入力内容がわかりません。

これが私のレイアウトです

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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"
android:isScrollContainer="false" >

<ScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/wood_floor" >

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content" >

        <com.tyczj.bowling.adapters.RobotoThinTextView
            android:id="@+id/textView2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="40dp"
            android:layout_marginTop="30dp"
            android:text="Add Bowler"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:textColor="#33b5e5"
            android:textSize="40dp" />

        <FrameLayout
            android:id="@+id/line"
            android:layout_width="fill_parent"
            android:layout_height="2dp"
            android:layout_alignParentLeft="true"
            android:layout_below="@+id/textView2"
            android:layout_marginLeft="20dp"
            android:layout_marginRight="20dp"
            android:layout_marginTop="8dp"
            android:background="@drawable/ab_solid_custom_blue_inverse_holo" >
        </FrameLayout>

        <com.tyczj.bowling.adapters.RobotoThinTextView
            android:id="@+id/textView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignLeft="@+id/line"
            android:layout_below="@+id/line"
            android:layout_marginTop="20dp"
            android:text="@string/bNameTV"
            android:textAppearance="?android:attr/textAppearanceMedium" />

        <EditText
            android:id="@+id/editText1"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_alignBottom="@+id/textView1"
            android:layout_below="@+id/line"
            android:layout_marginLeft="30dp"
            android:layout_marginRight="20dp"
            android:layout_toRightOf="@+id/textView1"
            android:inputType="textCapSentences" >

            <requestFocus />
        </EditText>

        <EditText
            android:id="@+id/editText2"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_alignBottom="@+id/textView3"
            android:layout_below="@+id/editText1"
            android:layout_marginLeft="30dp"
            android:layout_marginRight="20dp"
            android:layout_toRightOf="@+id/textView3"
            android:inputType="textCapSentences" >

            <requestFocus />
        </EditText>

        <com.tyczj.bowling.adapters.RobotoThinTextView
            android:id="@+id/textView3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignLeft="@+id/line"
            android:layout_below="@+id/textView1"
            android:layout_marginTop="20dp"
            android:text="@string/lNameTV"
            android:textAppearance="?android:attr/textAppearanceMedium" />

        <RadioButton
            android:id="@+id/radioButton1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignLeft="@+id/textView3"
            android:layout_below="@+id/textView3"
            android:layout_marginTop="15dp"
            android:checked="true"
            android:text="Right Handed" />

        <RadioButton
            android:id="@+id/radioButton2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignLeft="@+id/line"
            android:layout_below="@+id/radioButton1"
            android:text="Left Handed" />

        <Button
            android:id="@+id/done"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignLeft="@+id/line"
            android:layout_alignParentBottom="true"
            android:layout_below="@+id/radioButton2"
            android:onClick="onDoneClick"
            android:text="@string/done" />
    </RelativeLayout>
</ScrollView>

<com.google.ads.AdView
    android:id="@+id/ad"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    ads:adSize="IAB_BANNER"
    ads:loadAdOnCreate="true" />

</RelativeLayout>

マニフェストでandroid:windowSoftInputMode="stateVisible|adjustResize"アクティビティを設定しましたが、効果はありませんでした

キーボードが表示されたときに広告の移動を停止するにはどうすればよいですか?

4

2 に答える 2

0

LinearLayout最外部の代わりにを使用して、 withとwithRelativeLayoutを追加してみてください:ScrollViewandroid:layout_weight="1"AdViewandroid:layout_weight="0"

<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical">

  <ScrollView
    android:layout_width="fill_parent"
    android:layout_height="0"
    android:layout_weight="1"
    ...
    />
    ...
  </ScrollView>

  <com.google.ads.AdView
    android:layout_width="fill_parent"
    android:layout_height="0"
    android:layout_weight="0"
    .../>

</LinearLayout>
于 2013-02-10T17:51:00.447 に答える
0

モードadjustPanを試しましたか?それはあなたにとってよりうまくいくかもしれません。画面の下部に配置された要素を持つ RelativeLayout があるため、adjustResize は常にその要素を画面の下部に保持します。広告をスクロールビューの下に配置するのではなく、スクロールビューの下に配置することで、レイアウトをいじって問題を解決できる場合があります。

于 2013-02-10T17:24:36.260 に答える