更新 4.2 后,Android Studio 未显示工具栏选项

问题描述

在 Android Studio 4.2 版中删除了所有 v7 支持库。如何使用 androidx 工具栏创建操作栏?。我试过了,但上面没有显示标题或应用程序名称。 谢谢

解决方法

工具栏 XML

#ls -lah "/content/CarND-LaneLines-P1/vid4.mp4"
-rw-r--r-- 1 root root 1.4M May  9 14:42 /content/CarND-LaneLines-P1/vid4.mp4

Java

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

希望对您有所帮助。