2017-07-22 1 views
0

私はチャットレイアウトを作ろうとしています。問題は、私がEditTextに焦点を当てて、ソフトキーボードが現れ、すべてを押し上げることです。私はトップ(茶色)ヘッダー部分とメッセージのあるrecyclerviewがまだ見えるように、送信指示でボトム部分だけを押してください。 Facebookのメッセンジャーアプリには何かがあります。私は "調整パン、サイズ変更"とマニフェストファイルのすべてを入れてみましたが、それは動作しませんでした。何にフォーカスがないときここに私のデフォルトのレイアウトは次のとおりです。SoftKeyboardがすべてのビューをプッシュ

そして私はのEditTextとキーボードを押したときに、これは表示され、すべてをシフトアップ:

enter image description here私はもうヘッダーもrecyclerViewでメッセージを見ることができません。

基本的には、すべての要素を常に表示したいので、キーボードが押し上げられると、ヘッダー、メッセージ、および送信がユーザーに表示されます。ここで

は私のレイアウトコードです:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:orientation="vertical"> 

<LinearLayout 
    android:id="@+id/ll_profile" 
    android:layout_width="match_parent" 
    android:layout_height="60dp" 
    android:layout_alignParentTop="true" 
    android:layout_marginBottom="10dp" 
    android:layout_marginStart="10dp" 
    android:layout_marginTop="10dp"> 

    <de.hdodenhof.circleimageview.CircleImageView 
     android:id="@+id/iv_profile" 
     android:layout_width="40dp" 
     android:layout_height="40dp" 
     android:src="@drawable/img_back" /> 

    <TextView 
     android:id="@+id/tv_profile" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_gravity="center_vertical" 
     android:layout_marginStart="10dp" /> 
</LinearLayout> 

<android.support.v4.widget.NestedScrollView 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:layout_below="@id/ll_profile" 
    android:fillViewport="true" 
    android:isScrollContainer="false"> 

    <RelativeLayout 

     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:orientation="vertical"> 

     <View 
      android:id="@+id/view_line" 
      android:layout_width="match_parent" 
      android:layout_height="1dp" 
      android:layout_marginEnd="10dp" 
      android:layout_marginStart="10dp" 
      android:background="@color/gray_light_trans" /> 

     <LinearLayout 
      android:id="@+id/ll_send" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_alignParentBottom="true" 
      android:weightSum="10"> 

      <EditText 
       android:id="@+id/et_message" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_weight="9" 
       android:hint="Message" /> 

      <Button 
       android:id="@+id/btn_send" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_weight="1" 
       android:text="Send" /> 
     </LinearLayout> 

     <android.support.v7.widget.RecyclerView 
      android:id="@+id/rv_chat" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_above="@id/ll_send" 
      android:layout_below="@id/view_line" /> 
    </RelativeLayout> 
</android.support.v4.widget.NestedScrollView> 

+0

マニフェストの 'android:windowSoftInputMode'には何を設定しましたか? – santalu

+0

私が記事に書いたように、私は両方のパンを調整して、両方の組み合わせでサイズ調整を試みましたが、まだ効果がありません。 – hyrulelink16

+0

adjustPanはコンテンツを移動しますが、adjustResizeを設定するか設定しないと、 – santalu

答えて

0

利用アンドロイド:windowSoftInputMode =「stateHidden」あなたの活動にマニフェスト

0

での問題は、私は私のアプリでテーマを使用していたということでしたフルスクリーンのアクティビティでした。メインベースのテーマからフルスクリーンを削除したときに機能しています。

関連する問題