Я разрабатываю приложение для Android для 18-28 SDK. Версия поддерживаемых библиотек: 28.0.0-alpha1. Я начал делать свой проект и столкнулся со следующими проблемами с визуализацией макетов в Android-студии:
1) Панель действий не отображается. Сообщения об ошибках:
Render problem: Failed to load AppCompat ActionBar with unknown error.
The following classes could not be instantiated:
- android.support.v7.widget.ActionBarContainer (Open Class, Show Exception, Clear Cache)
- android.support.v7.widget.ActionBarContextView (Open Class, Show Exception, Clear Cache)
- android.support.v7.app.WindowDecorActionBar (Open Class, Show Exception, Clear Cache)
Tip: Use View.isInEditMode() in your custom views to skip code or show
sample data when shown in the IDE. If this is an unexpected error you can also try to build the project, then manually refresh the layout. Exception
Details java.lang.ClassNotFoundException:
android.view.View$OnUnhandledKeyEventListener Copy stack to clipboard
2) BottomNavigationView не отображается. Сообщения об ошибках:
Render problem: Failed to find style 'bottomNavigationStyle' in current theme
Missing styles. Is the correct theme chosen for this layout? Use the Theme
combo box above the layout to choose a different layout, or fix the theme
style references.
Я пытался принять решения Google и уже предпринял следующие шаги, которые мне не помогли:
1) С помощью ActionBar я добавил базовый префикс в текущий корень темы приложения в файле styles.xml, например:
<style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
Это помогло мне удалить указанное выше сообщение об ошибке, но я все еще не вижу свою панель инструментов по умолчанию. Еще я попробовал понизить библиотеку поддержки до версии 28.0.0-alpha1 (ранее это была последняя версия 28.0.0-rc2). 2) Для навигации снизу я попытался добавить атрибут стиля соответственно: https://material.io/develop/android/components/bottom-navigation-view/
<android.support.design.widget.BottomNavigationView
android:id="@+id/navigation"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="0dp"
android:layout_marginStart="0dp"
style="@style/Widget.MaterialComponents.BottomNavigationView.Colored"
android:background="?android:attr/windowBackground"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:menu="@menu/navigation" />
Надеюсь, вы покажете мне решение, точное в моей ситуации