0

Voir les images suivantes jointes. Quand je clique sur l'edittext, toute ma mise en page est poussée vers le haut. Le résultat devrait être que la barre d'outils & recyclerview devrait être fixée au sommet.Clavier virtuel Android poussant la barre d'outils et le recyclage vers le haut

Image 1

Image 2

Ma mise en page est comme indiqué ci-dessous:

<?xml version="1.0" encoding="utf-8"?> 

<android.support.percent.PercentRelativeLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    tools:context=".PostDetailActivity"> 

<android.support.v7.widget.Toolbar 
    android:id="@+id/toolbar" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:background="?attr/colorPrimary" 
    android:minHeight="?attr/actionBarSize" 
    android:fitsSystemWindows="true" 
    android:layout_alignParentTop="true" 
    android:theme="?attr/actionBarTheme" /> 

<android.support.v7.widget.RecyclerView 
    android:id="@+id/recycler_comments" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    app:layout_heightPercent="80%" 
    android:layout_below="@+id/toolbar" 
    android:paddingLeft="@dimen/activity_horizontal_margin" 
    android:paddingRight="@dimen/activity_horizontal_margin" 
    android:paddingTop="@dimen/activity_vertical_margin" 
    tools:listitem="@layout/item_comment"> 

</android.support.v7.widget.RecyclerView> 


    <LinearLayout 
     android:id="@+id/comment_form" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:orientation="horizontal" 
     android:layout_below="@+id/recycler_comments" 
     android:weightSum="1.0" 
     android:paddingLeft="@dimen/activity_horizontal_margin" 
     android:paddingRight="@dimen/activity_horizontal_margin" 
     android:paddingTop="@dimen/activity_vertical_margin"> 


     <EditText 
      android:id="@+id/field_comment_text" 
      android:layout_width="0dp" 
      android:layout_height="wrap_content" 
      android:layout_weight="0.8" 
      android:focusableInTouchMode="true" 
      android:hint="Write a comment..." 
      android:imeOptions="actionDone" 
      android:maxLines="1" /> 

     <Button 
      android:id="@+id/button_post_comment" 
      style="@style/Base.Widget.AppCompat.Button.Borderless" 
      android:layout_width="0dp" 
      android:layout_height="wrap_content" 
      android:layout_weight="0.2" 
      android:text="Post" /> 

    </LinearLayout> 

Mon fichier manifest.xml:

android:windowSoftInputMode="stateAlwaysHidden|adjustPan" 

J'ai déjà essayé "adjustResize" mais le problème est que ma linearlayout en bas se cache sous le clavier.

Alors, que dois-je faire?

Répondre

0

ajouter ceci à l'intérieur de votre manifeste

android:windowSoftInputMode="stateHidden" 

Xml mise en page

<?xml version="1.0" encoding="utf-8"?> 
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:id="@+id/coordinatorLayoutMain" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:background="@color/color_background"> 

    <android.support.design.widget.AppBarLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:background="@android:color/transparent" 
     android:fitsSystemWindows="true" 
     android:theme="@style/AppTheme" 
     app:elevation="0dp"> 

     <!-- Load the toolbar here --> 
     <include 
      layout="@layout/toolbar_grey" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" /> 

    </android.support.design.widget.AppBarLayout> 

    <RelativeLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_marginTop="?attr/actionBarSize" 
     android:orientation="vertical"> 


     <android.support.v7.widget.RecyclerView 
      android:id="@+id/recyclerViewUserChat" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:layout_above="@+id/relativeLayoutBottom" 
      android:scrollbars="vertical" /> 

     <RelativeLayout 
      android:id="@+id/relativeLayoutBottom" 
      android:layout_width="match_parent" 
      android:layout_height="45dp" 
      android:layout_alignParentBottom="true" 
      android:background="@color/color_chat_bottom"> 

      <LinearLayout 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:orientation="horizontal" 
       android:weightSum="1"> 

       <LinearLayout 
        android:layout_width="0dp" 
        android:layout_height="match_parent" 
        android:layout_margin="10dp" 
        android:layout_weight=".80" 
        android:background="@drawable/border_white_bg" 
        android:weightSum="1"> 

        <EditText 
         android:id="@+id/editTextMessage" 
         android:layout_width="match_parent" 
         android:layout_height="match_parent" 
         android:layout_marginLeft="10dp" 
         android:background="@android:color/transparent" 
         android:hint="@string/text_user_chat_hint" 
         android:inputType="textCapSentences" 
         android:singleLine="true" 
         android:textColor="@color/color_text" 
         android:textColorHint="@color/color_text" 
         android:textSize="14sp" /> 

       </LinearLayout> 

       <TextView 
        android:id="@+id/textViewDone" 
        android:layout_width="0dp" 
        android:layout_height="match_parent" 
        android:layout_weight=".20" 
        android:gravity="center" 
        android:text="@string/button_user_chat_send" 
        android:textColor="@color/color_profile_border" 
        android:textSize="14sp" 
        android:textStyle="bold"/> 
      </LinearLayout> 
     </RelativeLayout> 


    </RelativeLayout> 


</android.support.design.widget.CoordinatorLayout> 
+0

Non ça n'a pas –

+0

@PhilippWeigel j'ai mettre à jour mon réponse essayer maintenant – akhilesh0707

+0

supprimer adjustPan cela va fonctionner – akhilesh0707

0

Avez-vous essayé de changer PercentRelativeLayout à un CoordinatorLayout