android – 折叠工具栏标题消失

我在设计支持库23.0.1上,我正在使用带有视差图像的折叠工具栏布局.我不明白为什么当工具栏完全折叠(固定)时,如果单击一个操作按钮(特别是我刷新其图像),标题就会消失.之后,如果我将标题下拉到总扩展并重新点击操作按钮,标题将返回.

活动布局

<!-- App bar -->
<android.support.design.widget.AppBarLayout
    android:id="@+id/app_bar"
    android:layout_width="match_parent"
    android:layout_height="150dp"
    android:fitsSystemWindows="true"
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

    <!-- Collapsing toolbar layout -->
    <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:layout_scrollFlags="scroll|exitUntilCollapsed">

        <!-- Image Parallax -->
        <ImageView
            android:id="@+id/header"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:adjustViewBounds="true"
            android:contentDescription=""
            android:fitsSystemWindows="true"
            android:scaleType="centerCrop"
            edo:layout_collapseMode="parallax" />

        <!-- Toolbar -->
        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            app:layout_collapseMode="pin"
            edo:popupTheme="@style/ThemeOverlay.AppCompat.Light">

        </android.support.v7.widget.Toolbar>

    </android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>

<!-- nested scroll view -->
<android.support.v4.widget.nestedScrollView
    android:id="@+id/nested_scroll_view"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    edo:layout_behavior="@string/appbar_scrolling_view_behavior">

</android.support.v4.widget.nestedScrollView>

动作菜单布局

<item
    android:id="@+id/action_bookmark"
    android:icon="@mipmap/bookmark_empty_white"
    android:title="@string/add_news_to_bookmarks"
    app:showAsAction="ifRoom" />

选择的选项

@Override
public boolean onoptionsItemSelected(MenuItem item) {
    if (news != null) {
        switch (item.getItemId()) {
            case R.id.action_bookmark:
                if (Utils.isNetworkAvailable(activity)) {
                    if (news.getBookmarked()) {
                        bookmarked = false;
                        item.setIcon(R.mipmap.bookmark_empty_white);
                        deleteBookmark();
                    } else {
                        bookmarked = true;
                        item.setIcon(R.mipmap.bookmark_white);
                        postBookmark();
                    }
                } else {
                    handleError(Config.API_ERR_CONNECTION);
                }

                return true;
        }
    }

    return super.onoptionsItemSelected(item);
}

解决方法

这是Android方面的一个错误.他们已经意识到这一点,看起来可能会在将来的版本中修复: https://code.google.com/p/android/issues/detail?id=183333

变通方法发布在链接中,但没有一个解决我的问题.

编辑:问题已修复Support Library v23.1.0

相关文章

Android性能优化——之控件的优化 前面讲了图像的优化,接下...
前言 上一篇已经讲了如何实现textView中粗字体效果,里面主要...
最近项目重构,涉及到了数据库和文件下载,发现GreenDao这个...
WebView加载页面的两种方式 一、加载网络页面 加载网络页面,...
给APP全局设置字体主要分为两个方面来介绍 一、给原生界面设...
前言 最近UI大牛出了一版新的效果图,按照IOS的效果做的,页...