막무가내 삽질 블로그
CoordinatorLayout Sample 본문
<androidx.coordinatorlayout.widget.CoordinatorLayout 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=".coordinator.CoordinatorActivity">
    <com.google.android.material.appbar.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="140dp">
        <com.google.android.material.appbar.CollapsingToolbarLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:layout_scrollFlags="snap|enterAlways|scroll">
            <androidx.appcompat.widget.Toolbar
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                app:title="Toolbar" />
        </com.google.android.material.appbar.CollapsingToolbarLayout>
    </com.google.android.material.appbar.AppBarLayout>
    <androidx.recyclerview.widget.RecyclerView
        android:id="@+id/recycler_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
        app:layout_behavior="@string/appbar_scrolling_view_behavior"
        tools:itemCount="5"
        tools:listitem="@layout/item_coordinator" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>collapsingtoolbarlayout contentScrim 속성
app:contentScrim="@android:color/transparent"
툴바가 닫혔을 떄 투명색으로 변해 툴바에 이미지가 보이는 속성
toolbar에 layout_collapseMode속성 (스크롤이 발생했을 때 툴바의 최종형태)
pin : CollapsingToolbarLayout이 완전히 축소되면 툴바는 상단에 고정
parallax : 툴바가 축소되는 동안 시차? 모드로 동작
샘플코드
github.com/wj1227/Android-Sample-Test
wj1227/Android-Sample-Test
Android Test App. Contribute to wj1227/Android-Sample-Test development by creating an account on GitHub.
github.com
계속 업로드 중
: scrollflags
medium.com/martinomburajr/android-design-collapsing-toolbar-scrollflags-e1d8a05dcb02
Android Design — Collapsing Toolbar: ScrollFlags Illustrated
In this section we will look at CollapsingToolbar scrollflags, combining scrollflags and some considerations when implementing them.
medium.com
'Android' 카테고리의 다른 글
| Android Jetpack Navigation Graph Animations Transition + AppBar (0) | 2021.01.24 | 
|---|---|
| 안드로이드 깃허브 연동 에러 (2) | 2021.01.22 | 
| Android Context (2) | 2020.12.13 | 
| kotlin 요약 정리 (2) | 2020.12.09 | 
| 안드로이드 그래프 (android MPAndroidChart) (3) | 2020.11.06 | 
