Ich versuche, kollabierende Symbolleiste in meiner App zu verwenden. Ich möchte eine Ansicht wie this implementieren. Ich habe es versucht, aber nichts scheint zu helfen. Ich habe versucht, relatives Layout innerhalb meiner kollabierenden Toolbar-Tags hinzuzufügen, aber es scrollt genau wie ImageView und wird unsichtbar. Ich möchte, dass mein relatives Layout oben angeheftet wird, wenn die reduzierende Symbolleiste nicht wie in der Verknüpfung gezeigt erweitert wird.Wie wird ein minimales Symbolleistenlayout implementiert, bei dem benutzerdefinierte Textansichten oben angezeigt werden?
wie erreicht man das?
hier ist was ich bis jetzt getan habe.
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="350dp"
android:fitsSystemWindows="true"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:contentScrim="?attr/colorPrimary"
app:expandedTitleMarginBottom="32dp"
app:expandedTitleMarginEnd="64dp"
app:expandedTitleMarginStart="48dp"
app:expandedTitleTextAppearance="@android:color/transparent"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<ImageView
android:id="@+id/header"
android:layout_width="match_parent"
android:layout_height="250dp"
android:background="@mipmap/img_instructor"
android:fitsSystemWindows="true"
android:scaleType="centerCrop"
app:layout_collapseMode="parallax" />
<android.support.v7.widget.Toolbar
android:id="@+id/anim_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_gravity="bottom"
android:orientation="vertical"
app:layout_collapseMode="parallax"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
android:background="@color/colorPrimaryDark">
<RelativeLayout
android:layout_width="match_parent"
android:id="@+id/reltName"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/trainerName"
android:textColor="@color/white"
android:textStyle="bold"
android:textSize="@dimen/txt_25_sp"
android:layout_marginTop="16dp"
android:layout_marginLeft="16dp"
android:text="i am khan"/>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:id="@+id/relCategory"
android:layout_below="@+id/reltName"
app:layout_collapseMode="parallax"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/trainerCategories"
android:textColor="@color/white"
android:textStyle="bold"
android:textSize="16sp"
android:layout_marginLeft="16dp"
android:text="hello there"/>
</RelativeLayout>
</RelativeLayout>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v7.widget.RecyclerView
android:id="@+id/scrollableview"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
Sie sein benutzerdefinierten Titel Ihrer Symbolleiste festlegen und es wird ganz gut stecken – Max
ich nicht wa nt nur ein Titel, ich möchte ein lineares Layout an der Spitze fixiert werden – Newbiee