I’d like to have two adjacent views, a first that is a fixed size and a second that adjacent to the first that uses the remaining space.
I could easily do this with LinearLayout and weights, but I would like to avoid the “nested weights are bad for performance” problem.
Is there another layout type that can accomplish the equivalent? Please provide an example if so.
A
RelativeLayoutcould do what you want, for example:The first
Buttonwill be 200dp in width and the second will stretch to fill the rest of the parent’s remaining width.You could also use a
RelativeLayoutto split two views in equal sizes to avoid having double weights on some layouts.