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

CoordinatorLayout + scroll|enterAlways 하려니 이상하게 적용되네요

0 추천

 

안녕하세요 ^^

스크롤에 따라 상단바를 나타내고 없애고 하고 싶어서 CoordinatorLayout + scroll|enterAlways  적용시켰더니 

흐미 이상하게 적용되네요 ;; 아래는 코드입니다.

첫번쨰 사진은 CoordinatorLayout 가 렐러티브였고 앱바하고 툴바가 없었고 네시티드 스크롤뷰가 아니라 그냥 스크롤바였습니다.

<android.support.design.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:id="@+id/main_content"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    tools:context="yg.bonjapan.com.bonjapan.MainActivity">

    <android.support.design.widget.AppBarLayout   <<<<여기
        android:id="@+id/appbar"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">


    <android.support.v7.widget.Toolbar   <<<<여기
        android:id="@+id/toolbar"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="?attr/colorPrimary"
        app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
        app:layout_scrollFlags="scroll|enterAlways" />

    <RelativeLayout
        android:id="@+id/toolbar2"
        android:layout_width="match_parent"
        android:layout_height="50dp">

    <TextView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@drawable/blank_white"/>

        <ImageView
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:src="@drawable/logo"
            android:adjustViewBounds="true"
            android:baselineAlignBottom="false"
            android:onClick="onLogo"
            />
        <View
            android:layout_width="match_parent"
            android:layout_height="3dp"
            android:background="@drawable/shadow_up"
            android:layout_alignParentBottom="true"
            android:layout_alignParentLeft="true"
            android:layout_alignParentStart="true"
            />


        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/imageView3"
            android:background="@drawable/top_icon"
            android:layout_centerVertical="true"
            android:layout_alignParentRight="true"
            android:layout_alignParentEnd="true"
            android:layout_marginRight="10dp" />

        <TextView
            android:layout_width="40dp"
            android:layout_height="50dp"
            android:onClick="go_menu"
            android:layout_alignParentEnd="true"
            android:layout_alignParentRight="true"/>

    </RelativeLayout>

    <android.support.design.widget.TabLayout
        android:id="@+id/tabs"
        android:layout_width="match_parent"
        android:layout_height="@dimen/custom_tab_layout_height"
        app:tabMode="fixed"
        app:tabIndicatorHeight="@dimen/indicatorheight"
        app:tabPaddingStart="0dp"
        app:tabPaddingEnd="0dp"
        app:tabGravity="fill"
        android:layout_below="@+id/toolbar"
        />

    </android.support.design.widget.AppBarLayout>  

    <android.support.v4.view.ViewPager
        android:id="@+id/viewpager"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_below="@+id/tabs"
        app:layout_behavior="@string/appbar_scrolling_view_behavior"  <<<<여기
        />


    <View    <<<< 데코레이션용으로 선 넣었습니다 
        android:layout_width="match_parent"
        android:layout_height="3dp"
        android:background="@drawable/shadow_down"
        android:layout_below="@id/tabs"
        android:id="@+id/view" />

    <View    <<<< 데코레이션용으로 선 넣었습니다 
        android:layout_width="match_parent"
        android:layout_height="3dp"
        android:background="@drawable/shadow_up"
        android:id="@+id/view2"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true" />


    <android.support.v4.widget.NestedScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_below="@+id/view"
        android:id="@+id/scroll"
        android:scrollbarSize="2dp"
        app:layout_behavior="@string/appbar_scrolling_view_behavior"  <<<<여기
        android:background="#ffffff">
    <LinearLayout>
      이미지들..
    </LinearLayout>
    </android.support.v4.widget.NestedScrollView>

</android.support.design.widget.CoordinatorLayout>


제가 원하는건 http://makerj.tistory.com/182 여기 있는것처럼

적용전 모습에서 위에 앱바만 올라가고 내려가는것..입니다

코드도 저기 참고했고요 뭐가 잘못된건가요?ㅠ

껄껄앱 (1,910 포인트) 님이 2016년 5월 3일 질문

답변 달기

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