我正在尝试实现聊天窗口上 android google talk 应用程序的一部分的效果。
效果是有一个静态的顶部和底部,但您可以在各个打开的聊天之间滑动。
换句话说,我正在尝试设计一个屏幕,其中顶部和底部有一个静态部分,中间有一个动态部分,想想一个图库应用程序,它在顶部显示标题,“显示下一个”底部的“图像”按钮和中心的图片被替换为在活动之间切换时看到的相同过渡,唯一的区别是,我需要在中心替换更复杂的布局,而不是图像(几个文本视图和一个图像)
我应该如何去做呢?
我考虑过动画,但它似乎太复杂了,我考虑了片段,但我不知道它是否在所有版本上都支持,我还考虑过使用充气机在运行时进行绘制,但这不允许我进行“下一个活动” “ 影响。
I'm trying to achieve the effect that is part of the android google talk application on the chat window.
The effect is that there is a static top and bottom, but you can swipe between the various open chats that you have.
in other words, I'm trying to design a screen where there's a static section on top and on the bottom and a dynamic part in the center, think of a gallery app, where it shows you the title on top, a "show next image" button on the bottom and a picture in the center that gets replaced with the same transition you would see when switching between activities, only difference is that instead of an image, I need a more complex layout to be replaced in the center (a couple of text views and an image)
How should I go about doing that?
I thought about animations but it seems too complicated, and I thought about fragments but i don't know if it's supported on all versions or not and I also thought of drawing in runtime using the inflater but that doesnt let me do the "next activity" effect.
发布评论
评论(3)
尝试使用
ViewFlipper
类。这就是您正在寻找的。以下是一些示例:http://android- pro.blogspot.com/2010/09/using-view-flipper-in-android.html
http://www.androidpeople.com/android-viewflipper-example/
Try the
ViewFlipper
class. It's what you're looking for. Here are some examples:http://android-pro.blogspot.com/2010/09/using-view-flipper-in-android.html
http://www.androidpeople.com/android-viewflipper-example/
您可以使用RelativeLayout,并将页眉视图与顶部对齐,页脚视图与底部对齐,中间的图库视图(或包含将要更改的视图的某些布局)位于页脚视图上方,在标题视图下方。
You could use a RelativeLayout and have your header view aligned to the top of it, your footer view aligned to the bottom, and a middle Gallery view (or some layout that contains the views that will be changed) that is above the footer view and below the header view.
如果您对动画不感兴趣,您可以将所有布局放在屏幕中并使用 View.GONE/View.VISIBLE/View.INVISIBLE 标志进行播放。使用标签进行更好的编码。
IF you're not interested in the animations, you can just put all of your layouts in the screen and play with View.GONE/View.VISIBLE/View.INVISIBLE flags. use the tag for nicer coding.