相关疑难解决方法(0)

Android:有没有办法让fill_parent不缩小以适合父母的父级?

我的活动看起来像这样

| 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   |     ' …
Run Code Online (Sandbox Code Playgroud)

layout android dimensions

2
推荐指数
1
解决办法
997
查看次数

标签 统计

android ×1

dimensions ×1

layout ×1