마스터Q&A 안드로이드는 안드로이드 개발자들의 질문과 답변을 위한 지식 커뮤니티 사이트입니다. 안드로이드펍에서 운영하고 있습니다. [사용법, 운영진]

collapsing 툴바에 toolbar를 pin으로 고정하면 스크롤이 완벽하지 않습니다.

0 추천

 

Collapsing Toolbar로 헤더를 스크린으로 밀어 올리고, 툴바 영역은 남기는 형식으로 레이아웃을 구성했습니다만, 스크롤을  끝까지 밑으로 해도 Toolbar의 높이만큼 스크롤이 부족해집니다. 왜일까요?

 

이하  레이아웃 코드입니다.

 

<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=".MainActivity"
    >

    <com.google.android.material.appbar.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        >

        <com.google.android.material.appbar.CollapsingToolbarLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:toolbarId="@id/tool_bar"
            app:title="Title"
            app:titleEnabled="true"
            app:layout_scrollFlags="scroll|snap|exitUntilCollapsed"
            >

            <androidx.appcompat.widget.Toolbar
                android:id="@+id/tool_bar"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                app:layout_collapseMode="pin"
                />

            <FrameLayout
                android:layout_width="match_parent"
                android:layout_height="200dp"/>

        </com.google.android.material.appbar.CollapsingToolbarLayout>
    </com.google.android.material.appbar.AppBarLayout>

    <androidx.recyclerview.widget.RecyclerView
        android:id="@+id/list"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
        app:layout_behavior="@string/appbar_scrolling_view_behavior"
    />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
아파트202 (220 포인트) 님이 2019년 10월 6일 질문

답변 달기

· 글에 소스 코드 보기 좋게 넣는 법
· 질문에 대해 추가적인 질문이나 의견이 있으면 답변이 아니라 댓글로 달아주시기 바랍니다.
표시할 이름 (옵션):
개인정보: 당신의 이메일은 이 알림을 보내는데만 사용됩니다.
스팸 차단 검사:
스팸 검사를 다시 받지 않으려면 로그인하거나 혹은 가입 하세요.
...