긴 리스트나 그리드 형태의 데이터를 효율적으로 표시하는 UI 컴포넌트, 기존 ListView GridView보다 성능과 유연성이 향상되었다.
어떻게 향상되었냐?
layout_constraintStart_toEndof 가 이해가 안되었지만 이제는 이해할 수 있게 되었다.
아래와 같은 xml 레이아웃 코드가 있다고 가정한다.
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView 1"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView 2"
app:layout_constraintStart_toEndOf="@id/textView1"
app:layout_constraintTop_toTopOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>
여기서 2번째 TextView에 layout_constraintStart_toEndOf 를 이해해보자면
2번째 텍스트 뷰의 시작은
-> textView1의 끝으로 부터 시작된다.
라는 뜻이다.
정말 가독성을 위한 attr로 볼 수 있다.
<item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
이런 xml이 있다고하면
?attr 은 무엇일까?
현재 theme에서 정의된 colorPrimaryVariant라는 "속성"을 가져오는 것이다.
보통 ?attr/속성명 형태로 쓰인다.