Gamericious Blog :
I read something about layout nesting which some say is a bad practice but i have a xml layout where it makes me easier to group views with a linear layout and then constraint them too each other.
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/linearMarkStart"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/linearEndMark">
<TextView
android:id="@+id/mark_start"
android:text="@string/start_label"
android:textColor="#ffffffff"
android:textSize="14sp"
android:textStyle="bold"
android:labelFor="@+id/starttext"
android:clickable="true"
android:focusable="true"
android:gravity="center"
android:layout_width="wrap_content"
android:layout_height="31dip"/>
<EditText
android:id="@+id/starttext"
android:textSize="16sp"
android:textColor="@color/white"
android:inputType="number|numberDecimal"
android:layout_marginStart="10dip"
android:layout_marginEnd="30dip"
android:layout_width="70dip"
android:layout_height="wrap_content"
android:gravity="center" />
</LinearLayout>
<LinearLayout
android:id="@+id/linearEndMark"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/linearMarkStart">
<TextView
android:id="@+id/mark_end"
android:text="@string/end_label"
android:textColor="#ffffffff"
android:textSize="14sp"
android:textStyle="bold"
android:labelFor="@+id/endtext"
android:clickable="true"
android:focusable="true"
android:gravity="center"
android:layout_width="wrap_content"
android:layout_height="31dip" />
<EditText
android:id="@+id/endtext"
android:textSize="16sp"
android:textColor="@color/white"
android:inputType="number|numberDecimal"
android:layout_width="70dip"
android:layout_height="wrap_content"
android:layout_marginStart="10dip"
/>
</LinearLayout>
</ConstraintLayout>
What i have as output now by using 2 linearlayouts as childlayouts in constraintlayout and how i can achieve the same without those 2 linearlayouts because layout nesting is bad so it seems?
Henrique Becker :
For performance nested components/containers are better, but in some complex layouts they can make the code easy to understand and help to encapsulate code parts in separate reusable files.