Created
July 7, 2019 06:27
-
-
Save lukasdylan/8f1a7bdac523f92734bc106a81bbcc90 to your computer and use it in GitHub Desktop.
Collapsing Toolbar with extra layout
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<androidx.coordinatorlayout.widget.CoordinatorLayout | |
android:id="@+id/root_layout" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:fitsSystemWindows="true"> | |
<com.google.android.material.appbar.AppBarLayout | |
android:id="@+id/app_bar_layout" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:fitsSystemWindows="true"> | |
<com.google.android.material.appbar.CollapsingToolbarLayout | |
android:layout_width="match_parent" | |
android:layout_height="256dp" | |
android:fitsSystemWindows="true" | |
app:contentScrim="@color/colorPrimary" | |
app:layout_scrollFlags="scroll|exitUntilCollapsed|snap" | |
app:titleEnabled="false"> | |
<ImageView | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:fitsSystemWindows="true" | |
android:scaleType="centerCrop" | |
android:src="@drawable/background_arena" | |
app:layout_collapseMode="parallax" /> | |
<androidx.constraintlayout.widget.ConstraintLayout | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:background="@color/blackTransparent" | |
android:fitsSystemWindows="true" | |
app:layout_collapseMode="parallax" | |
app:layout_collapseParallaxMultiplier="0.7"> | |
<TextView | |
android:id="@+id/tv_score" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:layout_marginTop="16dp" | |
android:fontFamily="@font/fira_sans_semibold" | |
android:text="@{vm.matchScore}" | |
android:textColor="@android:color/white" | |
android:textSize="30sp" | |
app:layout_constraintBottom_toBottomOf="parent" | |
app:layout_constraintEnd_toStartOf="parent" | |
app:layout_constraintStart_toEndOf="parent" | |
app:layout_constraintTop_toTopOf="parent" /> | |
<ImageView | |
android:id="@+id/iv_home_team_icon" | |
android:layout_width="84dp" | |
android:layout_height="84dp" | |
android:layout_marginTop="16dp" | |
app:imageUrl="@{vm.homeTeamImageUrl}" | |
app:layout_constraintBottom_toBottomOf="parent" | |
app:layout_constraintEnd_toStartOf="@id/tv_score" | |
app:layout_constraintStart_toStartOf="parent" | |
app:layout_constraintTop_toTopOf="parent" | |
app:mode="@{mode}" | |
app:placeholder="@{placeholder}" /> | |
<ImageView | |
android:id="@+id/iv_away_team_icon" | |
android:layout_width="84dp" | |
android:layout_height="84dp" | |
android:layout_marginTop="16dp" | |
app:imageUrl="@{vm.awayTeamImageUrl}" | |
app:layout_constraintBottom_toBottomOf="parent" | |
app:layout_constraintEnd_toEndOf="parent" | |
app:layout_constraintStart_toEndOf="@id/tv_score" | |
app:layout_constraintTop_toTopOf="parent" | |
app:mode="@{mode}" | |
app:placeholder="@{placeholder}" /> | |
</androidx.constraintlayout.widget.ConstraintLayout> | |
<androidx.appcompat.widget.Toolbar | |
android:id="@+id/toolbar" | |
android:layout_width="match_parent" | |
android:layout_height="?attr/actionBarSize" | |
android:theme="@style/AppTheme.ThemeOverlay.Dark.ActionBar.Primary" | |
app:layout_collapseMode="pin" | |
app:navigationIcon="@drawable/vector_arrow_back" /> | |
</com.google.android.material.appbar.CollapsingToolbarLayout> | |
<com.google.android.material.tabs.TabLayout | |
android:id="@+id/tab_layout" | |
android:layout_width="match_parent" | |
android:layout_height="?attr/actionBarSize" | |
android:layout_marginTop="-12dp" | |
android:background="@drawable/white_top_rounded_background" | |
app:tabIndicatorColor="@android:color/holo_orange_dark" | |
app:tabRippleColor="@android:color/transparent" | |
app:tabSelectedTextColor="@android:color/holo_green_dark" /> | |
</com.google.android.material.appbar.AppBarLayout> | |
<androidx.viewpager.widget.ViewPager | |
android:id="@+id/view_pager" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
app:layout_behavior="@string/appbar_scrolling_view_behavior" /> | |
</androidx.coordinatorlayout.widget.CoordinatorLayout> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment