2016-04-25 5 views
0

ソフトキーボードを開いたときにトップヘッダーを非表示にする必要があるレイアウトがあります。私はここでフラグメントを使用しています。私はrecylerViewを使用しています。 トップヘッダーがソフトキーボードを開いているときにスクロールアップしています。私はそのヘッダーとRecyclerviewをスクロールするために必要です。ソフトキーボードが開いているときに上部にスティックヘッダーがあります

以下は私のXMLです。

<?xml version="1.0" encoding="utf-8"?> 
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     android:id="@+id/rel_parent" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:background="@drawable/bggradient"> 

     <RelativeLayout 
      android:id="@+id/rel_header" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginTop="15dp" 
      android:background="@drawable/drawable_below_line"> 

      <ImageView 
       android:id="@+id/iv_menu" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_alignBottom="@+id/txtSettingHeader" 
       android:layout_alignTop="@+id/txtSettingHeader" 
       android:layout_centerVertical="true" 
       android:background="@drawable/button_selector" 
       android:onClick="onClickEvent" 
       android:padding="10dp" 
       android:src="@mipmap/ic_back" /> 

      <TextView 
       android:id="@+id/txtUserName" 
       style="@style/FragHeader" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_centerHorizontal="true" /> 

      <ImageView 
       android:id="@+id/iv_userImage" 
       android:layout_width="50dp" 
       android:layout_height="wrap_content" 
       android:layout_alignBottom="@+id/txtUserName" 
       android:layout_alignParentRight="true" 
       android:layout_alignTop="@+id/txtUserName" 
       android:layout_centerVertical="true" 
       android:onClick="onViewClick" 
       android:paddingBottom="5dp" 
       android:paddingTop="5dp" 
       android:src="@mipmap/ic_male" /> 


     </RelativeLayout> 

     <LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:layout_above="@+id/lin_comment" 
      android:layout_below="@+id/rel_header" 
      android:gravity="top" 
      android:orientation="vertical"> 

      <android.support.v7.widget.RecyclerView 
       android:id="@+id/RecyelerViewChat" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:visibility="visible"> 

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

      <TextView 
       android:id="@+id/tv_txtNoRecords" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_weight="1" 
       android:gravity="center" 
       android:minHeight="100dp" 
       android:text="@string/txtNoChat" 
       android:textColor="@android:color/white" 
       android:visibility="gone" /> 
     </LinearLayout> 

     <LinearLayout 
      android:id="@+id/lin_comment" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_alignParentBottom="true" 
      android:background="#70FFFFFF" 
      android:gravity="center" 
      android:orientation="horizontal" 
      android:padding="5dp"> 

      <LinearLayout 
       android:id="@+id/linEditComment" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_weight="1" 
       android:focusableInTouchMode="true" 
       android:orientation="horizontal"> 

       <ImageView 
        android:id="@+id/iv_imgToggleKeyboardEmoji" 
        android:layout_width="wrap_content" 
        android:layout_height="match_parent" 
        android:clickable="true" 
        android:paddingLeft="10dp" 
        android:paddingRight="10dp" 
        android:src="@mipmap/ic_emoji" /> 

       <com.lawo.emojicon.EmojiconEditText 
        android:id="@+id/et_edtChat" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:background="@drawable/drawable_black_border" 
        android:hint="@string/hintTypeMessage" 
        android:inputType="textNoSuggestions|textMultiLine" 
        android:maxLength="500" 
        android:maxLines="3" 
        android:padding="10dp" 
        android:textColor="@android:color/black" 
        android:textColorHint="@android:color/darker_gray" /> 
      </LinearLayout> 

      <ImageView 
       android:id="@+id/iv_imgSend" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:clickable="true" 
       android:onClick="onClickEvent" 
       android:padding="10dp" 
       android:src="@mipmap/ic_sent" /> 

     </LinearLayout> 




    </RelativeLayout> 

答えて

0

のAndroidManifest.xmlであなたの "アクティビティ" タグに以下を追加します。

android:windowSoftInputMode="adjustResize" 

参考:Specify How Your UI Should Respondを。

+0

sofyKeyboardが開いたときにRecyclerViewをプッシュしません。 –

+0

'adjustPan'のような他の値を試しましたか?申し訳ありませんが、私はあなたのレイアウトを現時点ではテストできません。可能な値[ここ](http://developer.android.com/guide/topics/manifest/activity-element.html#wsoft)をご覧ください。 – Gustavo

関連する問題