2017-11-24 3 views
0

Meine XML-Datei wie unter seine Chat-Aktivität jemand die Tastatur öffnen, wie kann ich zufrieden mit Tastatur bilden ohne ToolbarWie Inhalt ohne Symbolleiste oben drücken, wenn sie geöffnet keybord in android

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout 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:background="@color/white" 
    tools:context="com.example.crowderia.chat.ChatActivity"> 

    <include 
     layout="@layout/toolbar_chat" 
     android:id="@+id/chat_page_toolbar"> 
    </include> 

    <android.support.v7.widget.RecyclerView 
     android:id="@+id/messages_list" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_alignParentStart="true" 
     android:layout_below="@+id/chat_page_toolbar" 
     android:layout_above="@id/linearLayout"> 

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

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignParentBottom="true" 
     android:paddingLeft="10dp" 
     android:paddingEnd="10dp" 
     android:layout_marginBottom="52dp" 
     android:id="@+id/linearLayout"> 

     <EditText 
      android:id="@+id/et_send_message" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:hint="Send a chat" 
      android:inputType="text" 
      android:textColor="@color/dark_grey" 
      android:imeOptions="actionSend"/> 

    </LinearLayout> 

</RelativeLayout> 

zu ändern, wenn ich die öffnen Tastatur nichts ändert all die Dinge, wie festgelegt, so kann ich nicht einmal sehen, was ich eingeben Wie kann ich dieses Problem beheben

Antwort

0

diese android:windowSoftInputMode="adjustPan" in Ihrer Aktivität der Manifest-Datei hinzufügen Versuchen Sie, wie diese

<activity 
    android:name=".YourActivity" 
    android:windowSoftInputMode="adjustResize" /> 

und NestedScrollView als Elternteil Ihr Layout hinzufügen, damit Sie bewegen können, während Tastatur geöffnet ist

<?xml version="1.0" encoding="utf-8"?> 
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    tools:context="com.ncrypted.bistrostays.activity.ReferralsActivity"> 

    <android.support.design.widget.AppBarLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> 

     <include 
      android:id="@+id/chat_page_toolbar" 
      layout="@layout/toolbar_chat"></include> 

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

    <android.support.v4.widget.NestedScrollView 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     app:layout_behavior="@string/appbar_scrolling_view_behavior"> 


     <RelativeLayout 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:background="@color/white" 
      tools:context="com.example.crowderia.chat.ChatActivity"> 


      <android.support.v7.widget.RecyclerView 
       android:id="@+id/messages_list" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:layout_above="@id/linearLayout" 
       android:layout_alignParentStart="true" 
       android:layout_below="@+id/chat_page_toolbar" 
       android:nestedScrollingEnabled="false"> 

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

      <LinearLayout 
       android:id="@+id/linearLayout" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_alignParentBottom="true" 
       android:layout_marginBottom="52dp" 
       android:paddingEnd="10dp" 
       android:paddingLeft="10dp"> 

       <EditText 
        android:id="@+id/et_send_message" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:hint="Send a chat" 
        android:imeOptions="actionSend" 
        android:inputType="text" 
        android:textColor="@color/dark_grey" /> 

      </LinearLayout> 

     </RelativeLayout> 
    </android.support.v4.widget.NestedScrollView> 
</android.support.design.widget.CoordinatorLayout> 
+0

@HemalHerath hinzufügen ** ** NestedScrollView als Ihre Eltern Layout – Prem

+0

mein Freund die Dinge in oben i hinzufügen kant dann nicht sir – HemalHerath

+0

@HemalHerath fügen Sie dies in ** 'NestedScrollView' ** **' app: layout_behavior = "@ string/appbar_scrolling_view_behavior" '** – Prem

Verwandte Themen