뷰(View)는 화면 안에 들어가는 각각의 요소를 말함. 일반적으로 컨트롤이나 위젯이라고 불림. 이러한 뷰를 여러 개 포함하고 있는 것을 뷰그룹(ViewGroup)이라고 한다.
View는 다른 View의 속성을 상속하여 상속받은 View의 특성을 그대로 가질 수도 있다. 예로 버튼은 TextView를 상속해서 만들어졌기 때문에 TextView의 속성을 그대로 갖고 있다.
안드로이드는 화면을 구성하는 것들을 크게 View와 ViewGroup으로 나눌 수 있다고 했는데, 각각의 역할을 구분하기 위해 View의 종류에 따라 다른 이름으로 부르기도 한다.
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
: layout_width랑 layout_heigh에는 3 종류의 값이 들어갈 수 있음.
ConstrainLayout, LinearLayout..