Ich arbeite an einer Chat-Anwendung und ich möchte eine Nachricht anzeigen, wenn der Benutzer bis zum Anfang der Nachrichtenliste scrollen.Android - Textansicht scrollen mit/vor Listview
Hier ist ein Bildschirm meiner Tätigkeit: Current appearance
Das rote Rechteck ist die Listenansicht von Nachrichten und die grünen ist die Nachricht (Textview) ich nur vor dem ersten Elemente der Liste angezeigt werden soll.
Nun ist die Textview in dem XML-Layout ist, so dass es „decken“ die Listenansicht (das heißt, ich will es scrollt, wenn die Listenansicht verschwinden).
Es ist mein xml-Code:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:id="@+id/content_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="fr.uha.tenich.talk2me.MainActivity"
tools:showIn="@layout/app_bar_main"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="50dp"
android:text="Vous avez atteint le début de ce salon"
android:textAppearance="@android:style/TextAppearance.Material.Medium"
android:textAlignment="center"
android:textColor="@android:color/darker_gray"
android:gravity="center_vertical"
android:background="@android:color/white"
android:id="@+id/debut_salon"/>
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">
<ListView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/current_channel_messages"
android:fillViewport="true"
android:divider="@android:color/white"
android:dividerHeight="1dp"
android:background="@android:color/white"
android:listSelector="@android:color/transparent" />
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="bottom">
<TextView
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@android:color/black"/>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:gravity="bottom"
android:background="@android:color/white">
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="text"
android:hint="Tapez votre message ici"
android:ems="10"
android:id="@+id/message_input"
android:layout_weight="3"
android:backgroundTint="@android:color/transparent" />
<ImageButton
app:srcCompat="@drawable/ic_menu_send"
android:layout_weight="1"
android:layout_height="match_parent"
android:layout_width="wrap_content"
android:background="@android:color/white"
android:onClick="onSendMessageClick" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
Wie kann ich die Textview machen "blättern" mit dem Listview?
Danke!