🎨 Programming/Android(Kotlin)
[Kotlin] 14. 안드로이드 패딩(padding) 및 마진(margin)
ryang x2
2020. 12. 3. 01:14
728x90
반응형
# 패딩(padding) 및 마진(margin)
* 마진(Margin) : 위젯(여기서는 TextView)이 부모 레이아웃의 테두리로부터의 여백을 말한다
* 패딩(Padding) : 위젯(여기서는 TextView) 테두리로부터 위젯 안에의 내용(여기서는 text)사이의 여백을 말한다
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_marginLeft="50dp"
android:layout_marginTop="20dp"
android:layout_marginRight="100dp"
android:layout_marginBottom="200dp"
android:background="#00bcd4"
android:text="안녕하세요" />
<TextView
android:layout_width="100dp"
android:layout_height="100dp"
android:background="#ff5722"
android:padding="20dp"
android:text="반갑습니다." />
<TextView
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_margin="200dp"
android:layout_marginLeft="200dp"
android:layout_marginTop="200dp"
android:layout_marginRight="200dp"
android:layout_marginBottom="200dp"
android:background="#ffc107" />
</LinearLayout>

728x90
반응형