Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- 알고리즘
- Navigation
- sqlite
- CustomView
- 코틀린
- Coroutine
- 백준
- kotlin
- Behavior
- BOJ
- CollapsingToolbarLayout
- room
- DataBinding
- lifecycle
- View
- LiveData
- recyclerview
- hilt
- 알림
- 안드로이드
- onMeasure
- AppBarLayout
- CoordinatorLayout
- Android
- ViewModel
- HTTP
- Algorithm
- onLayout
- activity
- notification
Archives
- Today
- Total
개발일지
삽질 - CoordinatorLayout, ViewPager 본문
CoordinatorLayout에서 ViewPager를 사용할 경우 이상하게 작동하는 경우가 있다. (ex : ViewPager가 짤린다.)
AppBarLayout과 같이 사용시 @string/appbar_scrolling_view_behavior를 behavior로 설정하자.
<?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:background="@color/black"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.viewpager2.widget.ViewPager2
android:id="@+id/view_pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.tabs.TabLayout
app:tabIconTint="@color/white"
app:tabIndicatorColor="@color/white"
app:tabTextColor="@color/white"
android:background="@color/black"
android:id="@+id/tab_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</com.google.android.material.appbar.AppBarLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</layout>
=> @string/appbar_scrolling_view_behavior는 Scroll이 가능한 View에 설정해야한다. (NestedScrollView, RecyclerView)
'삽질' 카테고리의 다른 글
삽질 - 주석 안될 때 (Ctrl + /) / 단축키 안될 때 (0) | 2021.03.02 |
---|---|
삽질 - Android Dialog match_parent (1) | 2021.02.08 |
삽질 - Navigation, ViewPager, setAdapter 오류 (0) | 2021.01.26 |
삽질 - StaggeredGridLayoutManager Margin (0) | 2021.01.20 |
삽질 - SQLite Add Foreign Key (0) | 2021.01.18 |
Comments