• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Layout development gone wrong

Hi, I'm new at the forum. I'm just starting and when I see tutorials on Youtube and read technical books by my own, there are some concepts that are misleading me. I think that this is because of a recent change on Layout development.

The thing is that when I anidate (sub)Layouts inside a general Layout:

<ConstraintLayout> (or Relative, or Linear...)
<LinearLayout/>
<LinearLayout/>
<LinearLayout/>
</ConstraintLayout>

None of them appear to be one after another. Even if I try to order them by weights or by a thing I saw on the API that's an attribute like android:layout_constraintTop_toBottomOf="parent" and so. How does it works actually? Thanks in advance. Is hard to start learning with that problems :'(
 
Your sub layouts will be arranged in accordance with the parent layout. For example if you use a LinearLayout in vertical mode, then all the sub layouts will appear from top to bottom.
It depends on the nature of your UI as to what kind of top level layout you use. If it's fairly complicated, then ConstraintLayout may be required. But this one is quite tricky for novices to master.
LinearLayout is the easiest to understand, and might be the best way to go if your UI is fairly simple.
I often use a combination of LinearLayouts (both vertical and horizontal orientation), to get my components to display as I want.

Bottom line is, I recommend starting off with LinearLayout, and experiment with weights, because that determines the proportion of screen taken up by each component.
 
Back
Top Bottom