0
Bugged titleCollapsingToolbarLayout顯示倒塌
時嘿,你可以在這個圖片中看到破碎的標題,我試圖用CollpasingToolbarLayout但標題沒有被正確繪製。在展開狀態下,我將標題設置爲淡出,如下所示:
val collapsingToolbarLayout = layout.findViewById<CollapsingToolbarLayout>(R.id.collapsing_toolbar)
collapsingToolbarLayout.setExpandedTitleColor(android.R.color.transparent)
所以展開狀態並不重要。我的xml看起來像這樣:
<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/app_bar_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
android:fitsSystemWindows="true"
app:expanded="false"
>
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:contentScrim="?attr/colorPrimary"
app:expandedTitleMarginStart="48dp"
app:expandedTitleMarginEnd="64dp"
android:fitsSystemWindows="true">
<CalendarView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="35dp"/>
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
app:title="Title"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
app:layout_collapseMode="pin">
</android.support.v7.widget.Toolbar>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:id="@+id/scroll"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<include layout="@layout/main_fragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</android.support.v4.widget.NestedScrollView>>
</android.support.design.widget.CoordinatorLayout>
Whan can I try?我想這是一個錯誤,但我不知道。謝謝