2010-09-23 6 views
3

J'ai une fenêtre d'entrée que j'affiche sur la vue principale de mes activités qui contient des zones d'édition. Lorsque la fenêtre contextuelle est affichée, la vue des activités reste grisée en arrière-plan (comme avec une boîte de dialogue d'alerte). Le problème que j'ai, c'est que lorsque le clavier apparaît, la fenêtre contextuelle est correcte, mais la vue des activités en arrière-plan est en train de changer. Cette vue devrait être mise en pause et je n'aurais pas pensé qu'elle serait affectée par le clavier du tout. Y at-il moyen d'empêcher que cela ne se produise?mise en page de fond se déplaçant lorsque le clavier logiciel est affiché - android

J'ai essayé d'ajouter android: windowSoftInputMode = "adjustPan" à l'activité et à la pop-up sans chance.

Voilà ma mise en page d'activité:

<LinearLayout 
xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:orientation="vertical" android:background="@drawable/main_bg"> 

<include android:id="@+id/header" layout="@layout/common_header" android:layout_width="fill_parent" android:layout_height="wrap_content"/> 

<RelativeLayout 
    android:id="@+id/contentLayout" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_margin="5dp" 
> 

<include android:id="@+id/btnBar" layout="@layout/common_button_bar" 
android:layout_width="fill_parent" 
android:layout_height="wrap_content" 
android:layout_alignParentBottom="true"/> 

    <LinearLayout 
    android:id="@+id/webLayout" 
    android:layout_above="@+id/btnBar" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:background="@drawable/blk" 
    android:layout_margin="10dp"> 

    <WebView 
android:id="@+id/WebView" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:layout_margin="1dp" 
android:background="@drawable/white" 
    > 


    </WebView> 

    </LinearLayout> 
</RelativeLayout> 
    </LinearLayout> 

et voici ma mise en page de pop-up:

<LinearLayout 
xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_height="wrap_content" 
android:orientation="vertical" 
android:background="@color/light_grey" android:layout_width="wrap_content"  android:minWidth="300dp"> 
<LinearLayout 
    android:id="@+id/main_inner_layout" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:orientation="vertical" 
    android:background="@color/white" 
    android:layout_margin="3dp" 
> 

    <TextView 
    android:id="@+id/enter_txt" 
    android:text="Enter Cup Code Below:" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:gravity="center_horizontal" 
    android:textColor="@color/black" 
    android:layout_gravity="left" 
    android:typeface="sans" 
    android:textSize="16dp" 
    android:layout_margin="10dp" 
     > 
    </TextView> 
    <RelativeLayout 
    android:id="@+id/code_layout" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_marginLeft="10dp" 
    android:layout_marginRight="10dp" 
    android:background="@color/white" 
    > 
    <EditText 
    android:text="12345" 
    android:id="@+id/CodeInputOne" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_marginRight="10dp" 
    android:layout_alignParentLeft="true" 
    ></EditText> 
    <EditText 
    android:text="12345" 
    android:id="@+id/CodeInputTwo" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_marginLeft="10dp" 
    android:layout_marginRight="10dp" 
    android:layout_centerHorizontal="true" 
    ></EditText> 
    <EditText 
    android:text="12345" 
    android:id="@+id/CodeInputThree" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_marginLeft="10dp" 
    android:layout_alignParentRight="true" 
     ></EditText> 
    </RelativeLayout> 
    <RelativeLayout 
    android:id="@+id/btn_layout_top" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_marginLeft="10dp" 
    android:layout_marginTop="10dp" 
    android:layout_marginRight="10dp" 
    android:background="@color/white" 
    > 
    <Button 
    android:id="@+id/AccountBtn" 
    android:textStyle="bold" 
    android:text="My Account" 
    android:layout_marginRight="5dp" 
    android:layout_alignParentLeft="true" 
    android:onClick="ClickHandler" 
    android:layout_height="40dp" 
    android:layout_width="130dp" 
    ></Button> 
    <Button 
    android:id="@+id/SubmitBtn" 
    android:textStyle="bold" 
    android:text="Submit" 
    android:layout_marginLeft="5dp" 
    android:layout_alignParentRight="true" 
    android:onClick="ClickHandler" 
    android:layout_height="40dp" 
    android:layout_width="130dp" 
    ></Button> 

    </RelativeLayout> 
    <RelativeLayout 
    android:id="@+id/btn_layout_bottom" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_marginLeft="10dp" 
    android:layout_marginRight="10dp" 
    android:background="@color/white" 
    > 
    <Button 
    android:id="@+id/RewardsBtn" 
    android:textStyle="bold" 
    android:text="Rewards" 
    android:layout_marginRight="5dp" 
    android:layout_alignParentLeft="true" 
    android:onClick="ClickHandler" 
    android:layout_height="40dp" 
    android:layout_width="130dp" 
     ></Button> 
    <Button 
    android:id="@+id/CancelBtn" 
    android:textStyle="bold" 
    android:text="Cancel" 
    android:layout_marginLeft="5dp" 
    android:layout_alignParentRight="true" 
    android:onClick="ClickHandler" 
    android:layout_height="40dp" 
    android:layout_width="130dp" 
    ></Button> 
    </RelativeLayout> 
</LinearLayout> 
</LinearLayout> 

Merci!

+0

Lorsque le système affiche le clavier logiciel, il règle en fait l'origine de la vue de votre activité! Il n'y a pas grand-chose à faire à ce sujet, vous devez en être conscient dans votre code de dessin. Le Soft Keyboard est géré par un service externe qui manipule l'activité à partir de laquelle il est appelé. –

Répondre

2

Essayez d'utiliser

android:windowSoftInputMode="adjustPan|adjustResize" 

pour l'activité.

+2

Raj, c'est fondamentalement faux. La documentation indique que plusieurs valeurs dans l'un ou l'autre groupe (ajuster ou groupe d'état) peuvent avoir des résultats indéfinis. Réf: [http://developer.android.fr/guide/topics/manifest/activity-element.html#wsoft] – Yogesh

Questions connexes