2016-09-10 5 views
2

Ich versuche, ein Kommentar/Chat-Layout mit einem RecyclerView und einem festen EditText an der Unterseite zu machen. Bitte sagen Sie nicht adjustPan oder adjustResize. Funktioniert nicht. adjustPan verbirgt die Tastatur.Android Soft-Tastatur versteckt RecyclerView

Ich brauche Hilfe bei dieser wirklich, es ist

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

    <android.support.design.widget.AppBarLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:id="@+id/appbarlayout" 
     android:paddingTop="@dimen/app_bar_top_padding"> 

     <android.support.v7.widget.Toolbar 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      app:theme="@style/ThemeOverlay.AppCompat.ActionBar" 
      android:id="@+id/toolbar" 
      app:titleTextColor="#FFFFFF" /> 

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


    <android.support.v7.widget.RecyclerView 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:id="@+id/recycler_view" 
     android:layout_below="@+id/appbarlayout" 
     android:isScrollContainer="false" 
     android:stackFromBottom="true" 
     android:transcriptMode="normal"/> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:background="#2b2b2b" 
     android:orientation="vertical" 
     android:id="@+id/chat_box" 
     android:layout_alignParentBottom="true"> 

     <View 
      android:layout_width="match_parent" 
      android:layout_height="1dp" 
      android:background="?android:attr/listDivider"/> 

     <FrameLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:padding="16dp"> 

      <EditText 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:hint="Skriv en kommentar" 
       android:background="@android:color/transparent" 
       android:textColor="@color/white" 
       android:textColorHint="#d4d4d4" 
       android:inputType="textCapSentences|textMultiLine" 
       android:layout_marginRight="40dp"/> 

      <ImageView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:src="@drawable/ic_send" 
       android:background="@drawable/click" 
       android:layout_gravity="right|center_vertical" /> 

     </FrameLayout> 

    </LinearLayout> 


</RelativeLayout> 

Antwort

1

Die richtige Antwort wirklich frustrierend, immer ist adjustResize, so dass der App über der Tastatur verkleinert. Damit dies jedoch funktioniert, muss der Rest Ihres Layouts in der Größe veränderbar sein. Deines ist nicht, da die Recycleransicht nicht an Ort und Stelle ist. Fügen Sie eine Einschränkung layout_above="@+id/chatBox" hinzu, so dass sie über dem Bearbeitungstext liegt, und sie sollte die Größe so anpassen, dass sie in den Platz passt.

Auch adjustPan versteckt die Tastatur nicht. Wenn dies der Fall ist, haben Sie etwas wirklich falsch in Ihrem Code. adjustPan verschiebt Ihre App ohne Größenänderung. Was Sie wollen, wenn Sie herausfinden können, was in Ihrer App die Tastatur versteckt.