0

Amis,RelativeLayout n'est pas Scrollable dans ScrollView

Vous ne savez pas pourquoi la mise en page suivante ne peut pas être défilée? J'ai un RelativeLayoput dans un ScrollView. Les vues correspondent à l'écran. Cependant, ils sont couverts chaque fois que le clavier apparaît. Je veux que l'écran de défilement lorsque le clavier apparaît, car il couvre le login et le mot de passe EditBoxes il est donc har de voir ce que quelqu'un est en train de taper

<?xml version="1.0" encoding="utf-8"?> 
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"  
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

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

     <com.alarm.alarmmobile.android.view.RobotoLightTextView 
      android:id="@+id/passcode_login_text" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginLeft="16dp" 
      android:layout_marginRight="16dp" 
      android:layout_marginTop="20dp" 
      android:text="@string/passcode_login_body" 
      android:textAppearance="?android:attr/textAppearanceSmall" /> 

     <EditText 
      android:id="@+id/passcode_login_username" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_below="@id/passcode_login_text" 
      android:layout_marginLeft="16dp" 
      android:layout_marginRight="16dp" 
      android:layout_marginTop="20dp" 
      android:hint="@string/login_textview_username" 
      android:singleLine="true" /> 

     <EditText 
      android:id="@+id/passcode_login_password" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_below="@id/passcode_login_username" 
      android:layout_marginLeft="16dp" 
      android:layout_marginRight="16dp" 
      android:hint="@string/login_textview_password" 
      android:inputType="textPassword" 
      android:singleLine="true" /> 

     <com.alarm.alarmmobile.android.view.RobotoLightButton 
      android:id="@+id/passcode_login_button" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignParentRight="true" 
      android:layout_below="@id/passcode_login_password" 
      android:layout_marginRight="16dp" 
      android:paddingLeft="20dp" 
      android:paddingRight="20dp" 
      android:text="@string/login_button_login" /> 

    </RelativeLayout> 

</ScrollView> 
+0

nous montrer comment on regarde –

+0

Essayez de mettre 'android: orientation = « verticale »' dans le ScrollView. –

+0

android: orientation = "vertical" ne le fixe pas. –

Répondre

0

Si tout peut s'adapter à l'écran, le ScrollView ne sera pas être capable de faire défiler n'importe où. Si un composant n'est pas entièrement visible, le défilement doit être disponible pour voir le reste du composant. Sans être capable de voir quel est le problème, il est difficile de trouver la solution exacte.

+0

Vous avez raison les deux EditBoxes correspondent à l'écran. Ils sont couverts chaque fois que le clavier apparaît. C'est quand je veux faire défiler le contenu. Comment je fais ça? –

+0

Comment est-ce que je le rends facile à sculpter même si le tout tient sur l'écran? –

1

Inclure dans votre Manifest:

<activity android:name="..." // your activity here 
    .... 
    android:windowSoftInputMode="adjustResize|adjustPan"> 
/> 

REMARQUE: Je ne sais pas si l'ajout adjustPan provoquera le problème de trouver à nouveau ou non.

+0

Cela fonctionne, mais existe-t-il une alternative de réaliser la même chose? J'ai besoin d'android: windowSoftInputMode = "adjustPan" –

1

sur l'activité ou la classe fragment de cette disposition que vous devez appeler ceci:

getWindow().setSoftInputMode(
      WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); 
+0

Cela fonctionne, mais y at-il une alternative de parvenir à la même chose? J'ai besoin d'android: windowSoftInputMode = "adjustPan" –

+0

'getWindow(). SetSoftInputMode (WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);' – luiscosta

Questions connexes