본문 바로가기
IT/안드로이드

design 에서 LinearLayout 정렬이 변경 됬을 때..

by 불멸남생 2023. 2. 9.

design 에서 LinearLayout 정렬이 변경 됬을 때..

LinearLayout 를 드래그 해서 조정하다 보니 LinearLayout 정렬애 깨지는 현상이 발생함.
드래그해서 조정하려 하니 화면이 더깨지기만함. 

많이 남감함..
(아직 실력이 없어서 원인 파악인 안됨...)

수정하려는 파일 선택(/app/res/layout/activity_main.xml) 에서 split 을 선택함.


xml 소스에서 해당 내용을 변경하면 됨.
수정전
...
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="72dp"
        android:orientation="horizontal">
        <EditText
            android:id="@+id/etnm"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:ems="10"
            android:inputType="textPersonName"
            android:text="" />
        <TextView
            android:id="@+id/tvnm"
            android:layout_width="20dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="이름"
            android:textAlignment="center" />
    </LinearLayout>
...


수정후
...
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="72dp"
        android:orientation="horizontal">
        <TextView
            android:id="@+id/tvnm"
            android:layout_width="20dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="이름"
            android:textAlignment="center" />
        <EditText
            android:id="@+id/etnm"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:ems="10"
            android:inputType="textPersonName"
            android:text="" />
    </LinearLayout>
...

반응형