【发布时间】:2014-12-12 12:38:22
【问题描述】:
您好,我需要在聊天屏幕中开发类似 这样的应用程序的布局 在此我想在聊天 textview 完成后显示时间。
我已经做到了
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/blue" >
<TextView
android:id="@+id/tv_message_chat_item_f"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="2dp"
android:layout_marginTop="2dp"
android:gravity="left|center"
android:paddingBottom="@dimen/one_dp"
android:paddingLeft="@dimen/fifteen_dp"
android:paddingRight="@dimen/five_dp"
android:paddingTop="@dimen/one_dp"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="fgfdgdf rete tretretret rtrtrwtw fgdfr grtwerwerewr ewrwerew" />
<TextView
android:id="@+id/tv_message_time_f"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_below="@+id/tv_message_chat_item_f"
android:layout_marginBottom="2dp"
android:paddingRight="@dimen/five_dp"
android:gravity="right"
android:paddingBottom="@dimen/one_dp"
android:text="fgfdg"
android:textAppearance="?android:attr/textAppearanceSmall" />
</RelativeLayout>
但不能处理大消息(texview 的时间设置不正确)
【问题讨论】:
-
使用 javapapers 教程:javapapers.com/android/android-chat-bubble
-
是的,我可以设置消息文本视图,但问题是什么时候,当我像上面的屏幕截图一样输入日期/时间时
-
正确使用重力或使用框架布局作为父布局,然后放置,时间始终正确。
-
我用过喜欢看编辑的阙。但我需要它,就像精确的屏幕截图一样,意味着当小消息时,相对布局必须像屏幕截图一样精确的宽度
-
或查看您的whatsapp。发送像 hi 这样的小消息并发送 3 4 行的消息,看看区别