Ich versuche, ein Chat-Layout zu machen. Das Problem ist, wenn ich den EditText fokussiere, erscheint Softkeyboard und schiebt alles nach oben. Ich möchte, dass es nur den unteren Teil mit Sendebefehlen anstößt, so dass der obere (braune) Header-Teil und eine Recyclerview mit Nachrichten immer noch sichtbar sind. Etwas, das Facebook Messenger-App hat. Ich habe versucht, "Pan anpassen, Größe ändern" und alles in der Manifest-Datei, aber es hat nicht funktioniert. Hier ist mein Standard-Layout, wenn nichts im Fokus ist: SoftKeyboard schiebt alle Ansichten
Und das ist, wenn ich die EditText drücken und Tastatur erscheint und schiebt alles auf:
ich nicht mehr Header sehen kann, noch die Nachricht in recyclerView.
Grundsätzlich möchte ich alle Elemente zu jeder Zeit sichtbar bleiben, so wenn nach oben, Header, Nachrichten und senden sind immer noch für den Benutzer sichtbar.
Hier ist mein Layout-Code:
<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>
Was haben Sie für 'android: windowSoftInputMode' in Manifest festgelegt? – santalu
wie ich in der Post geschrieben habe, habe ich versucht, sowohl die Pfanne anpassen und anpassen Größe in jeder Kombination gibt es, und immer noch keinen Effekt – hyrulelink16
adjustPan bewegt Ihren Inhalt, aber wenn Sie adjustResize oder nicht gesetzt, sollten Ihre Inhalte nicht bewegen. – santalu