2014-06-06 8 views
6

Ich habe eine Editext innerhalb der ScrollView. Wenn editext den Fokus erhält und die Soft-Tastatur angezeigt wird, wird ScrollView automatisch hochgedrückt.Scrollview hochgedrückt, wenn Android-Soft-Tastatur angezeigt wird

Ich habe

versucht

android:windowSoftInputMode="adjustResize" android:windowSoftInputMode="adjustPan"

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:background="@drawable/sign_in_or_sign_up_bg" > 

<RelativeLayout 
    android:id="@+id/headerlayout" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_alignParentTop="true" 
    android:background="@drawable/headerbox_title" > 

    <ImageButton 
     android:id="@+id/backImgBtn" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentLeft="true" 
     android:layout_centerVertical="true" 
     android:background="@null" 
     android:src="@drawable/backarrow" /> 
</RelativeLayout> 

<ScrollView 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:layout_below="@+id/headerlayout" 
    android:fillViewport="true" > 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_gravity="center" 
     android:gravity="center" 
     android:orientation="vertical" > 

     <ImageButton 
      android:id="@+id/profilePicImgBtn" 
      android:layout_width="@dimen/sign_up_profile_pic" 
      android:layout_height="@dimen/sign_up_profile_pic" 
      android:layout_gravity="center_horizontal" 
      android:background="@null" 
      android:scaleType="centerCrop" 
      android:src="@drawable/attach_image" /> 

     <EditText 
      android:id="@+id/userNameEdt" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_marginTop="@dimen/sign_in_small_margin" 
      android:background="@drawable/text_box" 
      android:hint="Username" 
      android:imeOptions="actionNext" 
      android:padding="@dimen/edt_padding" 
      android:singleLine="true" 
      android:textSize="@dimen/edt_hint" /> 

     <EditText 
      android:id="@+id/emailEdt" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_marginTop="@dimen/sign_in_small_margin" 
      android:background="@drawable/text_box" 
      android:hint="Email" 
      android:imeOptions="actionNext" 
      android:inputType="textEmailAddress" 
      android:padding="@dimen/edt_padding" 
      android:singleLine="true" 
      android:textSize="@dimen/edt_hint" /> 

     <EditText 
      android:id="@+id/passwordEdt" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_marginTop="@dimen/sign_in_small_margin" 
      android:background="@drawable/text_box" 
      android:hint="Password" 
      android:imeOptions="actionNext" 
      android:inputType="textPassword" 
      android:padding="@dimen/edt_padding" 
      android:singleLine="true" 
      android:textSize="@dimen/edt_hint" /> 

     <EditText 
      android:id="@+id/retypePasswordEdt" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_marginTop="@dimen/sign_in_small_margin" 
      android:background="@drawable/text_box" 
      android:hint="Retype Password" 
      android:imeOptions="actionDone" 
      android:inputType="textPassword" 
      android:padding="@dimen/edt_padding" 
      android:singleLine="true" 
      android:textSize="@dimen/edt_hint" /> 

     <ImageButton 
      android:id="@+id/signUpImgBtn" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_marginTop="@dimen/sign_in_large_margin" 
      android:background="@null" 
      android:src="@drawable/sing_up_main_btn" /> 
    </LinearLayout> 
</ScrollView> 

+0

Ist der fokussierte EditText noch sichtbar? –

+0

ja seine sichtbaren –

+0

versuchen adjustNothing es –

Antwort

7

In Ihrem oncreate hinzufügen

getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN); 

aktualisieren

Versuchen Sie, diese scrollview

android:isScrollContainer="false" 
+0

Ich habe versucht, diese –

1

In AndroidManifest.xml zu Ihrer hinzufügen, die richtige Aktivität finden und den windowSoftInputMode dort Einstellung hinzuzufügen. adjustPan muss auf die Aktivität angewendet werden.

<activity 
    android:name="com.yourpackage.YourActivity" 
    android:windowSoftInputMode="adjustPan" > <<=== THIS LINE === 
</activity> 

UPDATE: Anscheinend funktioniert das nicht, seit ich anfange, Stimmen unten zu erhalten. Vielleicht haben sich die Dinge geändert. Ich weiß, dass es für mich funktioniert hat.

+0

immer noch nicht funktioniert :( –

Verwandte Themen