I am new to Android. Is there any way we can design our layout with out any controls. I am using Relative layout but if I change one button, entire layout is disturbed. It is becoming very difficult to align buttons in custom way. Do we have any other layout which allow user to keep views in his desired position?
Share
You say you are using a
RelativeLayout, and that is the base cause for your troubles right now.In a
RelativeLayout, all elements define their positions relative to either the parent, or other elements in the layout. So if you have 10 elements, which depend on each other in the order1 <- 2 <- 3 <- 4 <- 5 <- 6 <- 7 <- 8 <- 9 <- 10, and you change the position of element 5. This will directly affect the position of element 6, and cause a domino effect right upto 10, effectively messing up your layout.However,
RelativeLayoutsare very flexible and useful layouts, once you get the hang of using them. On the other hand, if you’re simply stacking Views one on top of the other, consider using aLinearLayout.The documentation here can be particularly helpful when selecting a layout.