Zwijany pasek.
<?xml version="1.0" encoding="utf-8"?>
<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"
tools:context=".MainActivity"
android:background="#fafafa">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_height="180dp"
android:layout_width="match_parent"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
>
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/colappsingtoolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbarAlwaysDrawHorizontalTrack="false"
android:scrollbarAlwaysDrawVerticalTrack="false"
app:contentScrim="?attr/colorPrimaryDark"
app:expandedTitleMarginEnd="64dp"
app:expandedTitleMarginStart="48dp"
app:layout_scrollFlags="exitUntilCollapsed|scroll"
>
<ImageView
android:id="@+id/image_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="30dp"
android:paddingTop="20dp"
android:paddingRight="30dp"
android:paddingBottom="60dp"
android:scaleType="fitCenter"
android:src="@drawable/tlo" />
<android.support.v7.widget.Toolbar
android:id="@+id/toolbarid"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light">
</android.support.v7.widget.Toolbar>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/textView5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:text="aaaaaaaaaaaaaaaaaaaaaaa" />
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="150dp"
android:layout_marginLeft="16dp"
android:layout_marginTop="8dp"
android:layout_marginRight="16dp"
android:layout_marginBottom="12dp"
app:cardCornerRadius="4dp" />
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>
Wszystko pięknie działa. Ale chciałbym aby po zwinięciu paska pojawiła się nazwa aplikacji. Tak, wiem. Mogę to zrobić w taki sposób:
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/colappsingtoolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbarAlwaysDrawHorizontalTrack="false"
android:scrollbarAlwaysDrawVerticalTrack="false"
app:contentScrim="?attr/colorPrimaryDark"
app:title="NAZWA APLIKACJI"
app:expandedTitleMarginEnd="64dp"
app:expandedTitleMarginStart="48dp"
app:layout_scrollFlags="exitUntilCollapsed|scroll"
>
Tylko, że wtedy mam ten napis na dole większa czcionką która się zmniejsza a potem zostaje na zwiniętym Toolbarze. Da się to jakoś ogarnąć?