0
스크롤하는 동안 탭 레이아웃을 고정하고 툴바를 숨기려고합니다. 그래서 다음과 같은 코드를 사용하여 달성했지만 응용 프로그램 시작 및 활동을 만들 때 그것은 잘 작동 (스크롤 동안 맨 위에 고정)하지만 다른 조각으로 이동하고 컴백으로 돌아가서 툴바처럼 그냥 스크롤하지 않습니다. 나는 조각과 부모 홈 활동에 noActionbar 테마를 사용하고 있습니다. 아무도 도와 줄 수 있니? 당신이 TabLayout에 pin
에 app:layout_collapseMode
을 설정해야스크롤하는 동안 tablayout을 맨 위에 고정하는 방법
<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:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/background"
tools:context="com.plowns.droidapp.activites.HomeActivity">
<android.support.v4.view.ViewPager
android:id="@+id/viewpager"
android:layout_width="match_parent"
android:layout_height="fill_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/gradient_horizontal"
android:contentInsetEnd="0dp"
android:contentInsetLeft="0dp"
android:contentInsetRight="0dp"
android:contentInsetStart="0dp"
app:contentInsetEnd="0dp"
app:contentInsetLeft="0dp"
app:contentInsetRight="0dp"
app:contentInsetStart="0dp"
app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="@style/AppTheme.PopupOverlay">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:id="@+id/rl_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="10dp"
android:gravity="center_vertical">
</RelativeLayout>
</RelativeLayout>
</android.support.v7.widget.Toolbar>
<android.support.design.widget.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:elevation="8dp"
android:gravity="bottom"
app:tabGravity="fill"
app:tabIndicatorColor="@color/colorPrimary"
app:tabIndicatorHeight="3dp"
app:tabMode="scrollable"
app:tabSelectedTextColor="@color/white"
app:tabTextColor="@color/white" />
</android.support.design.widget.AppBarLayout>
아니요. 나는 collapsingToolbar를 사용하지 않습니다. –