【发布时间】:2014-12-10 08:39:36
【问题描述】:
我正在 android 中创建一个聊天应用程序。我在我的设计部分使用 ListView 设计我的聊天布局我正在使用 RelativeLayout 作为聊天界面,但是如果我使用 9patch 气泡背景,消息文本只能显示两行文本,如果我删除它可以显示三行文本9patch 气泡背景。下面是我的xml文件。为什么它不能显示所有文本?还有一件事我想要右边的聊天时间,但是当消息文本到达一行或多行时它被隐藏了。感谢您的帮助。
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/chat_wrapper"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="10dp"
android:paddingRight="10dp" >
<LinearLayout
android:id="@+id/chat_history"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<View
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:background="@android:color/darker_gray" />
<TextView
android:id="@+id/date_section"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:gravity="center_vertical"
android:text="02day12month"
android:textSize="12sp" />
<View
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:background="@android:color/darker_gray" />
</LinearLayout>
<RelativeLayout
android:id="@+id/chat_view_left"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/chat_history">
<TextView
android:id="@+id/msg_chatter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/msg_text_left"
android:text="Mr. Daroath" />
<TextView
android:id="@+id/msg_time_left"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignRight="@+id/msg_text_left"
android:layout_below="@+id/msg_text_left"
android:layout_marginTop="2dp"
android:text="10:20"
android:textColor="#808080"
android:textSize="12sp" />
<ImageView
android:id="@+id/reciever_profile_pic"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_alignParentLeft="true"
android:src="@drawable/ic_launcher" />
<TextView
android:id="@+id/msg_text_left"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/reciever_profile_pic"
android:layout_toRightOf="@+id/reciever_profile_pic"
android:text="Chat bubble is bubble in comic book that contains character's words. Some people call it speech bubble. Android app like eBuddy uses it when you are chatting with your friend."
android:textSize="14sp" /><!-- android:background="@drawable/partner" -->
</RelativeLayout>
</RelativeLayout>
【问题讨论】:
标签: android xml layout chat android-relativelayout