Tôi đang ở thư viện hỗ trợ thiết kế 23.0.1 và tôi đang sử dụng Bố cục thanh công cụ thu gọn với hình ảnh sai. Tôi không hiểu tại sao khi Thanh công cụ bị sập hoàn toàn (ghim) nếu một lần nhấp vào nút tác vụ (cụ thể là tôi làm mới hình ảnh của nó), tiêu đề biến mất. Sau đó nếu tôi thả xuống tiêu đề để mở rộng tổng số và reclick nút hành động tiêu đề trả về.Thu gọn tiêu đề Thanh công cụ Biến mất
LAYOUT HOẠT ĐỘNG
<!-- 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>
HÀNH ĐỘNG MENU LAYOUT
<item
android:id="@+id/action_bookmark"
android:icon="@mipmap/bookmark_empty_white"
android:title="@string/add_news_to_bookmarks"
app:showAsAction="ifRoom" />
tùy chọn đã chọn
@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);
}
Tôi đang gặp vấn đề chính xác tương tự, khi tôi nhấp vào tìm kiếm và trả lại tiêu đề của tôi biến mất. – firetrap