layout의 위치를 변경하려면 gravity 속성을 사용한다.


배치 위치는 | 로 구분하여 조합이 가능하다.

(예) 'right|bottom' 으로 작성하면 오른쪽 아래에 배치할 수 있다.) 


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
    <TextView
        android:layout_width="200dp"
        android:layout_height="50dp"
        android:gravity="left|top"
        android:text="왼쪽 위"/>
 
    <TextView
        android:layout_width="200dp"
        android:layout_height="50dp"
        android:gravity="right|top"
        android:text="오른쪽 위"/>
 
    <TextView
        android:layout_width="200dp"
        android:layout_height="50dp"
        android:gravity="right|bottom"
        android:text="오른쪽 아래"/>
 
    <TextView
        android:layout_width="200dp"
        android:layout_height="50dp"
        android:gravity="left|bottom"
        android:text="왼쪽 아래"/>
cs


+ Recent posts