java - 在 Android 中使用 AppCompatActivity

标签 java android appcompatactivity

按照 this tutorials 开发 Android 推送通知应用程序

这是我面临的问题,如图所示 .

enter image description here

最佳答案

您至少需要 22.1 版的支持库。 鉴于 ActionBarActivity 适合您,但 AppCompatActivity 不适合您,您可能拥有没有 AppCompatActivity 的旧版本支持库。

来自here :

The major revision for v22.1 is the deprecation of ActionBarActivity. It initially served as a convenient way to bring the ActionBar to the Android 2.1 and above, and would act as a compatibility layer for any version of Android that already included it (starting with Android 3.0 Honeycomb). Taking its place will be AppCompatActivity. On the surface, the new class will offer all of the same functionality, but it's built on top of a new AppCompatDelegate that can be used to enable most of the same features without requiring developers to inherit from AppCompatActivity. This re-engineering effort is also serving as the base for a new AlertDialog class, so every part of the user interface can benefit from the extensive list of theming features that were demonstrated for Lollipop.

转到您的 SDK 管理器查看您安装的支持库版本:

enter image description here

如果您的版本低于 22.1,请下载最新版本,然后用新版本替换项目中的 jar 文件。

关于java - 在 Android 中使用 AppCompatActivity,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33678719/

相关文章:

Android Studio 奇怪的警告

java - Spring MVC-以编程方式从appContext.xml加载bean定义

android - AWS S3 Android SDK : Get path of uploaded file

android - 如何应用于标准音频播放器?

android - 如何使用选择器更改 ImageButton 图像?

android - 迁移到 androidx 后 BottomNavigationView 膨胀错误

java - 没有端点 URL 的 WSDL

java - 如果我知道列位置,请更改 JTable 中的列标题

java - try-multicatch 与 ExceptionInInitializerError 和 ArithmeticException 混淆

android - 使用 Toolbar 和 SwipeRefreshLayout 的正确方法是什么?