Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

(Android View) Is elevation absolute or relative to parent?

If a button of elevation=5dp is attached to a LinearLayout of elevation=5dp,

Do we still see the button as being on the same level as the LinearLayout or 5dp above it?

like image 220
SadeepDarshana Avatar asked Jan 31 '23 02:01

SadeepDarshana


2 Answers

Yes you can see the button as being on the Linear layout. As Button is in linear layout, layout will be on 5dp elevation from the screen and Button will be on 5dp elevation from linear layout.

Esentailly the elevation is Relative.

like image 98
Vidhi Dave Avatar answered Feb 01 '23 17:02

Vidhi Dave


The elevation affects the view and the entire sub-collection of the view So, when we increase the view of the widow to 5dp elevations, the button also drops to 5dp, and the 5dp buttons make the parent 5dp higher.

like image 41
Mohamad.j Avatar answered Feb 01 '23 16:02

Mohamad.j