8

can someone give me a good explanation regarding Z order. Firstly, I don't understand what it is and(something like the definition)and secondly how an element of a Z order looks like. I hope I am explicit enough.

Andrei T
  • 2,985
  • 3
  • 21
  • 28

2 Answers2

10

Z order determines how objects lay on each other - that is which one is on top. This is good example for HTML (with example pictures). In android is simpler (that is in my opinion conception is simpler, but usage could be less easy) since there is no explicit z index. If you use xml layout z order is determined by order of declaration views declaration in xml but if you prefer you can also change order from java code.

Community
  • 1
  • 1
Maciek Sawicki
  • 6,717
  • 9
  • 34
  • 48
  • thanks mate for clearing this up for me. I was having some doubts regardin this. I was thinking that either it's something like i have a linear layout a text view(Z index 0 for example) and then if i have another linear layout inside if this next linear layout has other text view the Z index will be 1 or like you just said. So thanks again – Andrei T Sep 11 '11 at 00:06
  • Any way of doing this without changing the order? – someguy234 Nov 07 '14 at 04:32
1

Starting on Android API level 21 the Z order is also affected by the android:elevation for a more detailed explanation see my answer here https://stackoverflow.com/a/38536318/2168700

Community
  • 1
  • 1
lejonl
  • 1,453
  • 15
  • 20