LinearLayoutDemo-LinearLayout - 수직/수직 정렬(orientation)

CODEDRAGON Development/Android

반응형

LinearLayout - 수직/수직 정렬(orientation)

   

강의 내용

LinearLayout으로 부모 컨테이너 변경 > orientation

버튼1, 버튼2 추가하여 수직 정렬 확인

LinearLayout추가

버튼3, 버튼4 추가하여 수평 정령 (하나만 match_parent)

버튼3, 버튼4 모두 같은 크기 비율로 맞춰보기(모두 wrap_content/layout_weight="1")

버튼1을 layout_height="wrap_content"

 

직접 xml 코딩하면서 테스트

activity_main.xml

LinearLayout변경

-android:orientation="vertical"

-Graphical Layout > Form Widgets-Button추가 1

-Graphical Layout > Form Widgets-Button추가 2

수직 정렬확인

Graphical Layout > Layouts-LinearLayout 추가

-Graphical Layout > Form Widgets-Button추가 3

-Graphical Layout > Form Widgets-Button추가 4

-3, 4수평 정렬 (하나만 match_parent)

-3, 4모두 같은 크기 비율로 맞춰보기(모두 wrap_content/layout_weight="1")

-1 layout_height="wrap_content"

   

   

xml의 위젯 ID생성

@+id/id명

   

   

 

   

출력 결과

수직정렬 확인

   

수평정렬 확인

   

버튼3, 버튼4 모두 같은 크기의 비율로 맞추기

   

버튼1만 layout_height="match_parent"

 

반응형