이번에 배운 것은 화면의 배치 및 세부적인 요소들을 꾸미는 것이다.
- margin : 컴포넌트의 바깥 여백을 부여하는 기능. top, left right 등 특정한 위치에 여백을 줄 수도 있다.
- padding : margin과 비슷하지만 안쪽 여백을 부여하는 기능.
- textSize : dp 혹은 sp단위로 텍스트의 크기를 조절하는 기능. dp는 사용자가 임의로 바꿀 수 없다. sp는 휴대폰설정에서도 바꿀 수 있다.
- textStyle : 글씨체를 바꿀 수 있는 기능.
- textColor : 글자색을 바꿀 수 있다. 여기서 values -> color.xml에 컬러를 따로 추가를 해놓을 경우, 설정해놓은 이름으로도 편하게 사용이 가능하다.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
android:padding="16dp"
android:orientation="vertical">
<TextView
android:textStyle="bold"
android:textSize="20sp"
android:textColor="@color/custom_black"
android:text="@string/height"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<EditText
android:layout_marginTop="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="number" />
<TextView
android:textColor="@color/custom_black"
android:textStyle="bold"
android:textSize="20sp"
android:layout_marginTop="30dp"
android:text="@string/weight"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<EditText
android:layout_marginTop="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="number"
/>
<Button
android:layout_marginTop="50dp"
android:text="확인"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
<string name="height">신장</string>
<string name="weight">체중</string>
<color name="custom_black">#222222</color>