某些设备没有显示工具栏后退箭头+搜索视图图标

时间:2020-04-21 10:54:17

标签: android android-layout android-toolbar searchview android-design-library

我陷入一个愚蠢的问题。我创建了一个活动,如下所示:

enter image description here

您可以在此处看到向后箭头和该搜索图标(在工具栏下方)

现在某些设备未显示以下内容:

enter image description here

这是此活动的XML代码。

<androidx.coordinatorlayout.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=".activity.ProductMasterListActivity">

        <com.google.android.material.appbar.AppBarLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:theme="@style/AppTheme.AppBarOverlay">

            <androidx.appcompat.widget.Toolbar
                android:id="@+id/toolbar"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                android:background="?attr/colorPrimary"
                app:popupTheme="@style/AppTheme.PopupOverlay" />

            <androidx.appcompat.widget.SearchView
                android:id="@+id/searchView"
                app:layout_scrollFlags="exitUntilCollapsed"
                app:iconifiedByDefault="false"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginStart="@dimen/_5sdp"
                android:layout_marginBottom="@dimen/_5sdp"
                android:layout_marginEnd="@dimen/_5sdp"
                app:queryHint="@string/string_type_here_to_search"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toTopOf="parent" />

            <com.google.android.material.tabs.TabLayout
                android:id="@+id/tabs"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="?attr/colorPrimary"
                app:tabMode="scrollable" />
        </com.google.android.material.appbar.AppBarLayout>
        ...
        ...
    </androidx.coordinatorlayout.widget.CoordinatorLayout>
</layout>

有人可以帮忙吗?有人知道吗?

0 个答案:

没有答案
相关问题