聊天页面UI
一个普通聊天页面的ui,如下图:
示意图
##UI结构
ListView作为聊天信息显示区域
EditText作为信息输入框
Button信息发送按钮
其中ListView的context layout 设计为包含左右两个TextView的设计,通过Adapter在显示消息时决定使用layout的哪个TextView显示消息。
左右两个TextView背景图(仿聊天气泡)
##界面布局(layout)
**activity_main.xml **
主界面
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#d8e0e8"
android:orientation="vertical"
android:paddingBottom="16dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingTop="16dp"
tools:context="study.zhukai.com.chatroom.MainActivity">
android:id="@+id/msg_list_view"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:divider="#0000">
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:id="@