Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/kotlin/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 7中的Androidx导航图标兼容性问题_Android_Kotlin_Icons_Toolbar - Fatal编程技术网

Android 7中的Androidx导航图标兼容性问题

Android 7中的Androidx导航图标兼容性问题,android,kotlin,icons,toolbar,Android,Kotlin,Icons,Toolbar,我在我的应用程序和android 8中使用com.google.android.material.appbar.AppBarLayout以及androidx.appcompat.widget.Toolbar,它工作得非常好,但我遇到了一个问题,在android 7中,“汉堡包”菜单图标和“返回”图标仅显示为白色块(API 24和API 25)即使其他菜单图标显示正确 显示汉堡图标的位置 以及“后退”按钮的外观 我的应用程序栏布局: <com.google.android.materia

我在我的应用程序和android 8中使用com.google.android.material.appbar.AppBarLayout以及androidx.appcompat.widget.Toolbar,它工作得非常好,但我遇到了一个问题,在android 7中,“汉堡包”菜单图标和“返回”图标仅显示为白色块(API 24和API 25)即使其他菜单图标显示正确

显示汉堡图标的位置

以及“后退”按钮的外观

我的应用程序栏布局:

<com.google.android.material.appbar.AppBarLayout
        android:id="@+id/activity_drawer_layout_app_bar_layout"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize">

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

    </com.google.android.material.appbar.AppBarLayout>

使用材质库时,这是预期结果。我不知道Android 8中的编译器在默认情况下如何覆盖材质主题设置。如果使用材质库,默认情况下会应用颜色着色。有关更多详细信息,请参阅

您将在该网站上了解有关材料库的所有信息。

您可以在主题中应用色调或背景色

如果无法找到问题->在工具栏中添加ImageView(返回按钮)

例:



@tynn我有是的。正如我在后来的版本中所说,它显示得非常完美。到目前为止,问题似乎是api 24和api 25。您使用的是滤色器还是色调?无论是在代码、样式还是布局上?就像@crysxd所说的那样,它似乎在应用一个过滤器或色调,这些在旧版本的Android中处理方式不同,所以这是一个很好的起点。
setSupportActionBar ( toolbar )

    actionBar?.setDisplayShowCustomEnabled(true)
    actionBar?.setDisplayShowCustomEnabled(true)
    actionBar?.setDisplayHomeAsUpEnabled(true)
    actionBar?.setDisplayShowHomeEnabled(true)
    actionBar?.setDisplayShowTitleEnabled(true)
<Toolbar>
   <ImageView>
 </Toolbar>