<text 속성>
- 텍스트뷰의 문자열을 설정할 수 있음 (반드시 지정해야 함.)
- 텍스트뷰에 문자열이 없으면 텍스트뷰가 차지하는 영역을 알 수 없음.
- text 속성 값으로 직접 문자열을 넣거나 // app/res/values 폴더에서 strings.xml 파일에 작성한 문자열을 지정하는 방법
- text 속성을 찾아 @string/person_name 을 입력하면 해당 값이 텍스트 뷰에 나타남. (@string/... 와 같은 형식)
<color 속성>
- 텍스트뷰에서 표시하는 문자열의 색상을 설정
- #AARRGGBB (Alpha, Red, Green, Blue)
- Alpha - 투명하지 않음(FF), 투명함 (00), 반투명 (88)
<textSize 속성>
- 텍스트뷰에서 표시하는 문자열의 크기(폰트크기)를 설정
- 크기 단위 : sp, dp, px
- sp : 단말의 해상도에 따라 글자의 크기를 일정한 크기로 보일 수 있게 하며, 폰트 변경 시 해당 폰트도 반영되도록 함
<textStyle>
- 텍스트뷰에서 표시하는 문자열의 스타일 속성
- normal, bold,italic 등 // | 을 사용하여 여러 개의 속성 값을 지정할 수 있음
<typeFace>
- 텍스트뷰에서 표시하는 문자열의 폰트를 설정함
- normal, sans, serif, monospace
<maxLines>
- 텍스트뷰에서 표시하는 문자열의 최대 줄 수를 의미함
- maxLines을 넘어가는 부분은 표시가 되지 않음.
<?xml version="1.0" encoding="utf-8"?>
<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"
android:orientation="vertical"
tools:context=".MainActivity">
<TextView
android:id="@+id/textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/user_name"
android:textColor="#FF0000FF"
android:textSize="40sp"
android:textStyle="bold|italic"
android:typeface="serif" />
<TextView
android:id="@+id/textView2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="1"
android:text="@string/example"
android:textColor="#FFFF44FF"
android:textSize="50sp"
android:textStyle="bold|italic"
android:typeface="serif" />
</LinearLayout>