프레그먼트의 레이아웃이 ConstraintLayout으로 되어 있으신 것 같네요. ConstraintLayout은 constraint를 설정해줘야 제대로 동작하는 레이아웃입니다. 레이아웃 디자이너에 보이는 것은 디자인시에 보이는 레이아웃일 뿐 실제로 앱이 실행될 때 보여질 레이아웃과 동일하지 않을 수 있습니다. ConstraintLyoust에서 tools:* 로 되어있는 속성을 지워보시면 확인이 됩니다.
님의 디자인으로 봤을 때 해결방법은 두가지 입니다. 하나는 ConstraintLayout에 위, 아래, 시작, 종료 constraint 를 설정하는 것이고 다른 하나는 LinearLayout에 oriendtation을 vertical로 주는 겁니다.
ConstraintLayout을 사용했을 때는 아래처럼 사용하시면 됩니다.
<?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"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools">
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="60dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/text"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginVertical="40dp"
tools:text="@tools:sample/lorem/random"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/button" />
</androidx.constraintlayout.widget.ConstraintLayout>
constraint는 layout_constraint<시작>_<끝>Of 이런식으로 속성명이 결정됩니다. 최소한 top과 start에 해당하는 constraint가 두개는 지정이 되어야 하며, 없으면 0, 0 지점으로 점핑을 하게 됩니다.
따라서 app:layout_constraintStart_toStartOf="parent"는 start_start 이므로 시작지점을 나타냅니다.
레이아웃의 시작점을 나타냅니다. parent는 화면의 좌측시작점을 이라고 보면 됩니다.
end_end는 끝 top_top은 최상단 bottom_bottom 최하단.
top_bottom contrint 는 나의 top이 상대방의 bottom에 위치한 걸 말합니다. bottom_top은 그 반대이구요.
기본적인 constraint 는 조금만 사용해 보시면 간단합니다.
그리고 님의 레이아웃의 경우는 LinearLayout + vertical이 ConstraintLayout보다 성능이 더 좋을 것 같습니다.