spacemonkey
spacemonkey

Reputation: 133

FrameLayout vs Relative Layout for Image overlays

Is there an advantage to using the FrameLayout over the RelativeLayout for image overlays? Would it make sense to use one over the other if I plan to have the background image static , and the foreground image dragged and scaled by the user?

Upvotes: 0

Views: 1242

Answers (1)

Quanturium
Quanturium

Reputation: 5696

As a rule of thumb, you want to have a view hierarchy as flat as possible meaning the less nested view you have the better.

The logic inside a RelativeLayout is more complex than the one in FrameLayout. Therefore performances might be slightly better with a FrameLayout but I wouldn't count on this too much. However if using a RelativeLayout over a FrameLayout reduces your number of nested layouts, go for it!

Upvotes: 3

Related Questions