在 Android 中显示对话,就像 iOS 中的 iMessage 一样
我正在尝试编写一个需要显示两个人之间的对话的 Android 应用程序。是否可以实现它,使其 UI
看起来像 iOS 。另一方面,是否可以在左侧显示第一个人的消息,在右侧显示第二个人的消息?
我的第一个想法是在 Java 代码中动态使用 TextView
数组,将它们的重力
设置为左右。可以吗? OutOfMemoryException
怎么样?
问候 。
I'm trying to write an Android
application that needs to show the conversation between two person. Is it possible to implement it so that it's UI
looks like iMessage
in iOS . On the other hand, is it possible to display the first person's messages on the left, and the second person's messages on the right ?
My first idea is to use an array of TextView
, dynamically in Java code, setting their gravity
to right and left. Is it OK? What about OutOfMemoryException
?
Regards .
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
ListView (http://developer.android.com/reference/android/widget/ListView.html) 将成为 Activity 的根布局。您必须编写自己的 BaseAdapter 或 ListAdapter 并在 getView() 方法中交替视图的重力。
A ListView (http://developer.android.com/reference/android/widget/ListView.html) is going to be your root layout for the Activity. You will have to write your own BaseAdapter or ListAdapter and alternate the gravity of the views in the getView() method.