2013-02-10 3 views
0

В моем макете у меня есть рекламное объявление с изображением EditText в макете. Когда я остановлюсь в тексте редактирования, чтобы напечатать что-то появляется клавиатура и перемещаю AdMob объявления по EditText и вы не видите, что вы печатаете.Макет настраивается при отображении клавиатуры

это мой макет

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

в моем манифесте I set android:windowSoftInputMode="stateVisible|adjustResize" в действии, но это не повлияло

Как остановить перемещение объявления при появлении клавиатуры?

ответ

0

Вы пробовали режим adjustPan? Это может работать лучше для вас. Поскольку у вас есть RelativeLayout с элементом, выровненным в нижней части экрана, adjustResize всегда будет удерживать этот элемент в нижней части экрана. Вы можете сыграть с макетом, чтобы исправить ситуацию, выставив объявление как ниже scrollview, а не выравниваясь снизу.

+0

, если я добавлю, что в, объявление не двигается, но Scrollview не прокручивается, и он будет нужно, когда появится клавиатура, иначе вы не сможете добраться до любого из других элементов компоновки – tyczj

0

Попробуйте использовать LinearLayout вместо самому дальнему от центра RelativeLayout и добавьте ScrollView с android:layout_weight="1" и тому AdView с android: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> 
Смежные вопросы