2016-09-10 46 views
2

私はRecyclerViewと固定コメントEditTextでコメント/チャットのレイアウトを作っています。 adjustPanまたはadjustResizeと言ってはいけません。動作しません。 adjustPanはキーボードを非表示にします。AndroidソフトキーボードがRecyclerViewを隠す

は、私は本当にこれで助けを必要とし、それは本当にイライラなってきた

<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> 

答えて

1

正解はadjustResizeがあるので、アプリはキーボードの上にリサイズされます。しかし、それが機能するためには、レイアウトの残りの部分をサイズ変更可能にする必要があります。リサイクル業者の表示が固定されていないため、あなたのものはそうではありません。編集テキストの上にレイアウトするように、layout_above="@+id/chatBox"という制約を追加して、スペースに適切に合わせるようにサイズを変更する必要があります。

また、adjustPanはキーボードを非表示にしません。そうであれば、あなたのコードには本当に間違ったことがあります。 adjustPanは、サイズ変更せずにアプリケーションをスライドさせます。あなたのアプリで何がキーボードを隠しているかを知ることができれば、あなたが望むものかもしれません。

関連する問題