코틀린 7-1 linear layout

hong030·2022년 1월 30일
0
layout_weight 특성을 쓰면 여백을 채운다... 여기선 b1:b2가 1:3 비율.

android:orientation = "vertical"

<Button
	android:text="b1"
    ...
	android:layout_weight="1"
/>

<Button
	android:text="b2"
    ...
    android:layout_weight="3"
/>

layout_height = "0dp"
layout_weight="1" 로 설정하면서 높이를 정할 수도 있다.



텍스트에 gravity 속성을 넣어서 정렬할 수 있다.
    <TextView
        android:layout_width="150dp"
        android:layout_height="150dp"
        android:text="hwllo"
        android:background="#FF9900"
        android:gravity="right|bottom"/>
여기서 gravity는 text 내 글자 배치 (오른쪽 아래),

만약 텍스트 뷰 자체를 레이아웃 가운데에 배치하고 싶다면 layout에다
android:gravity="center" 설정을 넣기.
profile
자바 주력, 프론트 공부 중인 초보 개발자. / https://github.com/hongjaewonP

0개의 댓글