티스토리 뷰
CoordinatorLayout
AppBarLayout
MaterialToolbar
app:layout_scrollFlags
app:layout_behavior="@string/appbar_scrolling_view_behavior"
fragment_plant_detail.xml
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:id="@+id/cnl_"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.appbar.MaterialToolbar
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_scrollFlags="scroll|enterAlways"
app:title="@string/app_name" />
</com.google.android.material.appbar.AppBarLayout>
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="800dp"
android:gravity="center"
android:text="1"
android:textSize="30sp" />
<TextView
android:layout_width="match_parent"
android:layout_height="800dp"
android:gravity="center"
android:text="2"
android:textSize="30sp" />
<TextView
android:layout_width="match_parent"
android:layout_height="800dp"
android:gravity="center"
android:text="3"
android:textSize="30sp" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</layout>
app:layout_scrollFlags 의 종류
- app:layout_scrollFlags="scroll|enterAlways" (스크롤 내리면 툴바 노출, 스크롤 올리면 툴바 사라짐)
- app:layout_scrollFlags="scroll|enterAlwaysCollapsed" (스크롤 최상단까지 내리면 툴바 노출, 스크롤 올리면 툴바 사라짐)
- app:layout_scrollFlags="scroll|exitUntilCollapsed" (반응 없음. CollapsingToolbarLayout 사용할 때 쓰임)
- app:layout_scrollFlags="scroll|snap" ("enterAlwaysCollapsed"와 동일한 효과. CollapsingToolbarLayout 사용할 때 쓰임)
'Android > Kotlin' 카테고리의 다른 글
[Kotlin] View (0) | 2021.05.25 |
---|---|
[Kotlin] dp와 px (0) | 2021.05.25 |
[Kotlin] CollapsingToolbarLayout (0) | 2021.05.24 |
[Kotlin] Navigation (0) | 2021.05.23 |
[Kotlin] Hilt (0) | 2021.05.23 |
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- View
- 코틀린
- recyclerview
- Intent
- activity
- MVVM
- 안드로이드 #코틀린 #Android #Kotlin
- JSONObject
- Vue.js #Vue.js + javascript
- Design Pattern
- coroutine
- ViewPager2
- Kotlin
- DataBinding
- java
- ViewModel
- ArrayList
- 안드로이드
- fragment
- TabLayout
- XML
- Android
- 혀가 길지 않은 개발자
- JSONArray
- CoordinatorLayout
- James Kim
- Architecture Pattern
- handler
- 자바
- Livedata
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
글 보관함