안녕하세요 ^^
스크롤에 따라 상단바를 나타내고 없애고 하고 싶어서 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 여기 있는것처럼
적용전 모습에서 위에 앱바만 올라가고 내려가는것..입니다
코드도 저기 참고했고요 뭐가 잘못된건가요?ㅠ