마스터Q&A 안드로이드는 안드로이드 개발자들의 질문과 답변을 위한 지식 커뮤니티 사이트입니다. 안드로이드펍에서 운영하고 있습니다. [사용법, 운영진]

ConstraintLayout 배치가 이상하게 됩니다 [closed]

0 추천
<?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:id="@+id/container"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <!--  android:paddingTop="?attr/actionBarSize" -->

    <com.google.android.material.bottomnavigation.BottomNavigationView
        android:id="@+id/nav_view"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginStart="0dp"
        android:layout_marginEnd="0dp"
        android:background="?android:attr/windowBackground"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:menu="@menu/bottom_nav_menu" />

    <fragment
        android:id="@+id/nav_host_fragment"
        android:name="androidx.navigation.fragment.NavHostFragment"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:defaultNavHost="true"
        app:layout_constraintBottom_toTopOf="@id/nav_view"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toBottomOf="@id/nav_linear"
        app:navGraph="@navigation/mobile_navigation" />

    <LinearLayout
        android:id="@+id/nav_linear"
        android:orientation="horizontal"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginStart="0dp"
        android:layout_marginEnd="0dp"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent">

        <TextView
            android:id="@+id/nav_linear_textView"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:textSize="25sp"
            android:text="안녕하세요"/>

        <EditText
            android:id="@+id/nav_linear_editText"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"/>

    </LinearLayout>

</androidx.constraintlayout.widget.ConstraintLayout>

 

위가 xml파일 데이터인데 fragment 같은경우 

app:layout_constraintBottom_toTopOf="@id/nav_view"

app:layout_constraintTop_toBottomOf="@id/nav_linear"

 

속성을 주어 배치하였는데 실질적으로 뽑혀나오는 화면이 

 

 

위와 같이 중첩되어 표시됩니다 ㅜㅜ

검색해보고 확인해보았는데 id값을 주고 배치하면 그 아래에 정상적으로 배치되는 예제들을 많이 보았는데

어떠한 코드가 문제가 있어 위와같이 나오는지 알수가 없습니다

도움주시면 감사하겠습니다 ㅜㅜ

질문을 종료한 이유: 해결
zkzkzhzj (1,670 포인트) 님이 2019년 12월 23일 질문
zkzkzhzj님이 2019년 12월 24일 closed
...