Android 找不到操作栏 class
Android ActionBar class could not be found
我正在尝试向我的 main_activity 添加一个 ActionBar,但是我收到错误
The following classes could not be found:
- android.support.v7.internal.app.WindowDecorActionBar
我同时安装了支持库和支持库,想知道我应该添加哪些依赖项来解决这个问题。最低 SDK 版本为 15,目标 SDK 版本为 23(如果这有助于解决问题)。我是 Android 开发的新手,如果我听起来很愚蠢,请见谅!
final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
final ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayShowTitleEnabled(true);
actionBar.setDisplayHomeAsUpEnabled(true);
}
并且在您的 xml 布局文件中
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?android:attr/actionBarSize"
android:popupTheme="@style/ThemeOverlay.AppCompat.Dark" />
我正在尝试向我的 main_activity 添加一个 ActionBar,但是我收到错误
The following classes could not be found:
- android.support.v7.internal.app.WindowDecorActionBar
我同时安装了支持库和支持库,想知道我应该添加哪些依赖项来解决这个问题。最低 SDK 版本为 15,目标 SDK 版本为 23(如果这有助于解决问题)。我是 Android 开发的新手,如果我听起来很愚蠢,请见谅!
final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
final ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayShowTitleEnabled(true);
actionBar.setDisplayHomeAsUpEnabled(true);
}
并且在您的 xml 布局文件中
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?android:attr/actionBarSize"
android:popupTheme="@style/ThemeOverlay.AppCompat.Dark" />