Android聊天应用程序xml布局

Android聊天应用程序xml布局,android,xml,layout,client-server,chat,Android,Xml,Layout,Client Server,Chat,我正在为Android做一个聊天应用程序。聊天屏幕应该是怎样的?有人能告诉我在XML布局中应该使用哪些视图吗?它是edittext和listview吗?请帮忙。我需要制作一个聊天屏幕,就像我们在Gtalk中看到的那样。两个人的聊天信息应该对齐到屏幕的两侧(请参见Gtalk聊天盒对齐样式)。这就是我想要的。我如何实现此布局? 找到了合适的。所以我在这里分享 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/and

我正在为Android做一个聊天应用程序。聊天屏幕应该是怎样的?有人能告诉我在XML布局中应该使用哪些视图吗?它是edittext和listview吗?请帮忙。我需要制作一个聊天屏幕,就像我们在Gtalk中看到的那样。两个人的聊天信息应该对齐到屏幕的两侧(请参见Gtalk聊天盒对齐样式)。这就是我想要的。我如何实现此布局?
找到了合适的。所以我在这里分享

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

<ScrollView 
    android:layout_width="fill_parent"
    android:layout_height="0dip" 
    android:layout_weight="1"  >
    <TextView 
        android:text="@string/text" 
        android:id="@+id/textOutput"
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content"
        android:paddingLeft="5dp" 
        android:paddingRight="5dp" 
        android:paddingTop="5dp" />
</ScrollView>

<LinearLayout 
    android:id="@+id/linearLayout1"
    android:orientation="horizontal" 
    android:layout_width="fill_parent"
    android:layout_height="wrap_content" 
    android:paddingLeft="5dp" 
    android:paddingRight="5dp"
    android:paddingBottom="5dp"
    android:baselineAligned="true">
    <EditText android:layout_weight="1" android:id="@+id/textInput"
        android:layout_height="45dp" android:layout_width="0dip">
        <requestFocus></requestFocus>
    </EditText>
    <Button android:text="Send"
        android:layout_height="45dp" android:layout_width="125dp"
        android:id="@+id/btnSend"></Button>
</LinearLayout>


您应该查看一些关于回收器视图和适配器的教程。您可以创建两个ViewHolder,一个用于发送的邮件,另一个用于接收的邮件,并根据邮件类型对其进行充气

此链接提供了如何创建聊天用户界面的示例。

@raghav-sood我可以从服务器检索用户详细信息,但我不知道如何显示对话中双方的聊天信息。我需要一个listview、一个edittext和一个submit按钮,还是需要TextView和edittext和按钮?这是我的疑问。我建议你去读一些关于适配器的教程,尝试实现该教程,然后,如果你在某个特定点上遇到问题,请回来询问。@Budis我做了所有这些事情。我仍然不知道哪种方法更好,请建议一种可能的副本