Bry*_*eld 2 layout android dimensions
我的活动看起来像这样
| header |
|------------------|
| ViewGroup |
| that fills |
| the screen |
| |
| centered |
| button |
| |
|------------------|
| footer |
Run Code Online (Sandbox Code Playgroud)
填充屏幕的视图组是RelativeLayout的子项,RelativeLayout用fill_parent和layout_below标题以及layout_above页脚填充屏幕.该RelativeLayout下的ViewGroup在运行时设置为RelativeLayout的相同宽度和高度.
它在运行时设置相同高度的原因是因为这个视图组可以用手指向左拖动(类似于Android主屏幕)如果我将它拖到左边就可以了.但是如果我把它拖到右边,我的fill_parent尺寸会搞砸.
| header |
|------------------|
| ' ViewGroup | '
| ' that fills| '
| ' the screen| '
| ' | '
| ' centered | <-- button not centered. It is only centered on the visible area, not the whole thing
| ' button | '
| ' | '
| ' | '
|------------------|
| footer |
Run Code Online (Sandbox Code Playgroud)
我正在进行定位的方法是设置ViewGroup的左边距,将其向右移动(或将其设置为负值以将其向左移动)
HorizontalScrollView.这是android的顶视图
' previous ' current ' next ' # Three panes that can be dragged to switch between
| | # The android screen bounderies
Run Code Online (Sandbox Code Playgroud)
我正在计划用户能够通过左右拖动屏幕来进行下一个/上一个.如果用户拖动屏幕一点点,他/她慢慢地
' previous ' current ' next '
| |
Run Code Online (Sandbox Code Playgroud)
然后屏幕应该动画回原位
' previous ' current ' next '
| |
Run Code Online (Sandbox Code Playgroud)
如果用户快速完成
' previous ' current ' next '
| |
Run Code Online (Sandbox Code Playgroud)
然后屏幕应该为剩下的方式设置动画
' previous ' current ' next '
| |
Run Code Online (Sandbox Code Playgroud)
以前应该成为新的潮流,我们应该有一个新的前一个
' previous ' current ' next '
| |
Run Code Online (Sandbox Code Playgroud)
我用了一个scrollview,我会做这样的事情
' previous ' current ' next '
| |
Run Code Online (Sandbox Code Playgroud)
除非我跳过滚动,否则现在没有新的前一个空间了
' previous ' current ' next '
| |
Run Code Online (Sandbox Code Playgroud)
这对我来说听起来更糟糕.
所以我的选择是
AbsoluteLayout (已弃用/不使用它)RelativeLayout.LayoutParams.setMargins (见下文.这就是我现在正在做的事情)LayoutManager(听起来比现在容易)Views(DirectDraw或OpenGL)HorizontalScrollView| 归档时间: |
|
| 查看次数: |
997 次 |
| 最近记录: |