它是一个不好的做法,使用负利润率的Android? [英] Is it a bad practice to use negative margins in Android?
问题描述
这似乎工作,你所期望的布局重叠,如果他们发生冲突的方式。但我不希望碰到一个更大的问题没有做正确的事情从一开始就在这个项目。
It seems to work the way you'd expect with overlapping of the layouts if they collide. But I don't want to run into a bigger problem for not doing things right from the start in this project.
该方案是简单的,基于行的LinearLayout
有一些的 N 行,我想某些行重叠或入侵的,如果你想要的,previous行的边框。正如我所说的,这部作品在模拟器,至今我还没有发现任何理由不使用它,但我想知道如果你们遇到的任何问题,这种类型的做法。
The scenario is simple, a row based LinearLayout
that has a number n of rows and I want some of the rows to overlap or invade if you want, the bounding box of the previous row. As I said, this works in the emulator and so far I haven't found any reason not to use it but I'd like to know if any of you have encountered any problems with this type of practice.
推荐答案
在2010年,@RomainGuy(核Android工程师)说,<一个href="https://groups.google.com/group/android-developers/browse_thread/thread/daf7c7c42df78ed2">negative利润率有不确定的行为。
In 2010, @RomainGuy (core Android engineer) stated that negative margins had unspecified behavior.
在2011年,@RomainGuy指出,你可以在的LinearLayout
使用切缘阴性和 RelativeLayout的
。
In 2011, @RomainGuy stated that you can use negative margins on LinearLayout
and RelativeLayout
.
恕我直言,最后一个胜场,所以我与后者罗曼-LY建议去。 : - )
IMHO, last one in wins, so I'd go with the latter Romain-ly advice. :-)
这篇关于它是一个不好的做法,使用负利润率的Android?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!