[英]Android: on swipe switch between Views / Activities / Fragments
I'm implementing a chat application. 我正在实现一个聊天应用程序。 The user is able to have multiple chats open simultaneously, and I want to allow him to switch between these chats with swiping left or right. 用户可以同时打开多个聊天,我想允许他在左右滑动这些聊天之间切换。 Like eg in the gtalk app. 例如在gtalk app中。 I'm not sure what's the best way to implement this: 我不确定实现这个的最佳方法是什么:
What do you think is the best solution, and why? 您认为最好的解决方案是什么?为什么? Any suggestions? 有什么建议么? Thanks for your help! 谢谢你的帮助!
I would suggest taking a look at the following Android Dev blog post about using ViewPager in the Android Compatibility Package to implement the swipe functionality you're looking for: 我建议您查看以下Android Dev博客文章,了解如何在Android兼容包中使用ViewPager来实现您正在寻找的滑动功能:
http://android-developers.blogspot.com/2011/08/horizontal-view-swiping-with-viewpager.html http://android-developers.blogspot.com/2011/08/horizontal-view-swiping-with-viewpager.html
The recommended approach is most likely to use a Fragment for the chat history and text input field as this will give you the most flexibility across devices. 建议的方法最有可能使用片段作为聊天记录和文本输入字段,因为这将为您提供跨设备的最大灵活性。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.