2016-09-10 2 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은 크기를 조정하지 않고 앱을 슬라이드합니다. 어떤 앱에서 키보드를 숨기고 있는지 알아낼 수 있다면 원하는 것일 수 있습니다.