When you first starting out with Android understanding different layouts, but mostly attributes can be tricky. Let’s look at the most common and confusing ones here
One of the most common ones is layout_, it’s in layout_width/height, layout_margin and many more. What it means is this attribute meant for parent layout to size and position this view. Ones without layout_ is for view itself, like padding
layout_ itself doesn’t mean anything, Android could’ve just skipped it and call android:width. If you want to learn about creating custom view’s and attributes for them – check this post
Does it make any difference in creating layouts? I don’t think so, just good to know meaning of it
This one is very common. Especially you see it everywhere with CoordinatorLayout. And there’s many more attributes like this which you just use, if they work – great, no need to understand actually how. And in most cases it’s like this, all templates have this attribute set if needed.
Default one is actually true for views and false for layouts seems like. When set to true, your view goes below status bar. By below I mean there’s a status bar and then there’s your view, without overlay. The best is just to test it with NavigationDrawer template.
For example if you want to have translucent status/navigation bar and draw content under them so that they overlay content, you need to set fitSystemWindows to false.
Anyways, it’s better to read right from Google about this here
Another very common thing is to see attributes from wrong layouts. For example having orientation in other than LinearLayout, layout_gravity in RelativeLayout etc. It doesn’t affect anything and lint will actually tell you that this attribute is useless there
P.S. there’s also nice set of tutorials about ConstraintLayout that you can check here
Formerly an Android developer, lately picked up some Flutter. This blog is everything that I find exciting about Android and Flutter development. Stay tuned and hope to see you again!