我的行为看起来像这样
| header |
|------------------|
| ViewGroup |
| that fills |
| the screen |
| |
| centered |
| button |
| |
|------------------|
| footer |
查看组中,填补了屏幕是一个RelativeLayout的是RelativeLayout的填充FILL_PARENT和layout_below页眉和页脚layout_above屏幕的孩子。根据该RelativeLayout的所述的ViewGroup设置为RelativeLayout的在运行时相同的宽度和高度。
The View Group that fills the screen is a child of a RelativeLayout that RelativeLayout fills the screen with fill_parent and layout_below header and layout_above footer. The ViewGroup under that RelativeLayout is set to the same width and height of the RelativeLayout at runtime.
它被设置在同一高度在运行时的原因是因为这种观点组可以拖动到左边用手指(类似于Android主屏幕)。如果我将它拖动到左侧它是好的。但是,如果我将其拖动到右边我FILL_PARENT方面搞的一团糟。
The reason it is set the same height at runtime is because this view group can be dragged over to the left with a finger (similar to the Android home screen) If I drag it to the left it is fine. But if I drag it to the right my fill_parent dimensions get messed up.
| header |
|------------------|
| ' ViewGroup | '
| ' that fills| '
| ' the screen| '
| ' | '
| ' centered | <-- button not centered. It is only centered on the visible area, not the whole thing
| ' button | '
| ' | '
| ' | '
|------------------|
| footer |
我在做定位的方法是通过设置的ViewGroup的左旁这将转移是正确的(或者将它设置为负左移位吧)
The way I am doing the positioning is by setting the left margin of the ViewGroup which will shift it right (or setting it negative to shift it left)
下面是Android的俯视图
Here is a top view of the android
' previous ' current ' next ' # Three panes that can be dragged to switch between
| | # The android screen bounderies
我计划让用户能够通过拖动屏幕左,右去下一/ previous。如果用户拖动屏幕上一点,他/她做它慢慢
I am planning for the user to be able to go next/previous by dragging the screen right and left. If the user drags the screen a little and he/she does it slowly
' previous ' current ' next '
| |
这时屏幕应该到位动画回来
Then the screens should animate back in place
' previous ' current ' next '
| |
如果用户快速地做它
' previous ' current ' next '
| |
然后屏幕应该动画的方式休息
Then the screens should animate the rest of the way
' previous ' current ' next '
| |
previous应该成为新的当前,我们应该有一个新的previous
Previous should become the new current and we should have a new previous
' previous ' current ' next '
| |
我用了一个滚动视图我会做这样的事情
I used a scrollview I would be doing something like this
' previous ' current ' next '
| |
现在没有空间的一个新的previous除非我跳滚动
Now there is no room for a new previous unless I jump the scrolling
' previous ' current ' next '
| |
这听起来更糟了我。
which sounds even worse to me.
所以,我的选择是
AbsoluteLayout
(德pcated /不使用它,$ P $)
RelativeLayout.LayoutParams.setMargins
(见下文。这就是我现在所做的)
在写我自己的布局管理
(听起来比它更容易)
在画,而不是使用查看
S(DirectDraw或OpenGL的)像素到屏幕
HorizontalScrollView
AbsoluteLayout
(deprecated / don't use it)
RelativeLayout.LayoutParams.setMargins
(See below. This is what I am doing now)
Write my own LayoutManager
(Sounds easier than it is)
Draw the pixels to the screen instead of using View
s (DirectDraw or OpenGL)
HorizontalScrollView
如果您设置一个积极的左边缘,那么你也应该设定一个负的右边缘。这允许的ViewGroup继续关闭屏幕的边缘上的右手侧。
If you set a positive left margin then you should also set a negative right margin. This allows the ViewGroup to continue off the edge of the screen on the right hand side.