Menu
Who Do Is
  • Home
  • What
  • How
  • Is
  • Can
  • Are
  • Does
  • Do
  • Why
  • Who
  • Where
  • Which
  • Which
  • Should
  • Will
  • When
  • What’s
  • Did
Who Do Is

[ANSWERED] Android Studio: Layout incomprehensibly positioned

Posted on November 14, 2022

Solution 1 :

In layout3, instead of

 android_layout_width="match_parent"

write:

 android_layout_width="0dp"

and it will be placed right next to the top of layout2.

In case you wonder how it has a wide range even with width=0dp, it is because of these 2 constraints:

app:layout_constraintEnd_toEndOf="parent"
app_layout_constraintStart_toEndOf="@id/layout2"

They pull LinearLayout to 2 opposite sides, and as a result it unwraps.

Problem :

I’ve been trying out for a long time now but I just don’t understand why “layout3” extends to the edge of the root element and not just to the right edge of “layout2” as I wanted it to.
Here is the XML code:

<?xml version="1.0" encoding="utf-8"?>

<androidx.constraintlayout.widget.ConstraintLayout
xmlns_android="http://schemas.android.com/apk/res/android"
xmlns_app="http://schemas.android.com/apk/res-auto"
xmlns_tools="http://schemas.android.com/tools"
android_layout_width="match_parent"
android_layout_height="match_parent"
android_orientation="vertical"
android_layout_marginBottom="50dp"
android_id="@+id/layout1">

<TextView
    android_layout_width="224dp"
    android_layout_height="159dp"
    app_layout_constraintTop_toTopOf="parent"
    android_layout_marginTop="184dp"
    app_layout_constraintVertical_bias="0.5"
    app_layout_constraintStart_toStartOf="parent"
    app_layout_constraintEnd_toEndOf="parent"
    app_layout_constraintHorizontal_bias="0.5"
    android_id="@+id/textview1"/>

<LinearLayout
    android_orientation="vertical"
    android_layout_width="match_parent"
    android_layout_height="wrap_content"
    app_layout_constraintTop_toBottomOf="@+id/textview1"
    android_layout_marginTop="20dp"
    app_layout_constraintStart_toStartOf="@id/layout1"
    app_layout_constraintEnd_toEndOf="@id/layout1"
    android_layout_marginEnd="500dp"
    android_id="@+id/layout2">

    <TextView
        android_layout_width="224dp"
        android_layout_height="159dp"
        android_layout_marginTop="20dp"
        android_layout_marginBottom="20dp"
        android_layout_marginStart="20dp"
        android_id="@+id/textview2"/>

</LinearLayout>

<LinearLayout
    android_orientation="vertical"
    android_layout_width="match_parent"
    android_layout_height="100dp"
    app_layout_constraintTop_toBottomOf="@+id/textview1"
    android_layout_marginTop="20dp"
    app_layout_constraintStart_toEndOf="@id/layout2"
    app_layout_constraintEnd_toEndOf="@id/layout1"
    android_id="@+id/layout3">

</LinearLayout>

</androidx.constraintlayout.widget.ConstraintLayout>

Here is a picture from the editor:

READ  [ANSWERED] Deprecation warning in gradle in Android Studio in Flutter project
Powered by Inline Related Posts

Recent Posts

  • How can I play with my cat without toys?
  • What is a bag pipe band called?
  • Are Honda Civics actually fast?
  • Are Yankee candles toxic?
  • How do I pair my Michael Kors smartwatch with my Android?

Recent Comments

No comments to show.

Archives

  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022

Categories

  • ¿Cómo
  • ¿Cuál
  • ¿Cuántas
  • ¿Cuánto
  • ¿Que
  • ¿Quién
  • 90” and 108” so you may have to round up to the nearest size.
  • and delete any Spotify folders from it. Once this is done
  • Android
  • Are
  • At
  • Bei
  • blink
  • C'est
  • Can
  • carbs
  • Comment
  • Did
  • Do
  • Does
  • During
  • For
  • Has
  • How
  • In
  • Is
  • Ist
  • Kann
  • Können
  • nouveau
  • On
  • or 108 inches.2020-08-03
  • Où
  • owning
  • Pourquoi
  • Puis-je
  • Quand
  • Quante
  • Quel
  • Quelle
  • Quelles
  • Quels
  • Qui
  • Should
  • Sind
  • Sollte
  • spiritual
  • tap the downward-facing arrow on the top left. A downward-facing arrow will appear underneath each song in the album; they'll turn green as the download completes.2020-07-28
  • Uncategorized
  • Wann
  • Warum
  • Was
  • Welche
  • Welcher
  • Welches
  • Welke
  • Wer
  • Were
  • What
  • What's
  • When
  • Where
  • Which
  • Who
  • Whose
  • Why
  • Wie
  • Will
  • Wo
  • Woher
  • you will receive two curtains each with the same measurements of width 66"" (168cm) x drop 54""(137cm).
  • you'll see a green downward-facing arrow next to each song.2021-02-26
©2023 Who Do Is | Powered by SuperbThemes & WordPress