前提・実現したいこと
Android StdioでBottom Navigation Activity を使おうとしたのですが、activity_main.xmlのdesignにnavigationが表示されないのです。
発生している問題・エラーメッセージ
render problem
Failed to find style 'bottomNavigationStyle' in current theme Tip: Try to refresh the layout.
missing style
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.
failed to instantiate one or more classes
The following classes could not be instantiated:
- android.support.design.widget.BottomNavigationView (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.IllegalArgumentException: The style on this component requires your app theme to be Theme.AppCompat (or a descendant). at android.support.design.internal.ThemeEnforcement.checkTheme(ThemeEnforcement.java:221) at android.support.design.internal.ThemeEnforcement.checkAppCompatTheme(ThemeEnforcement.java:196) at android.support.design.internal.ThemeEnforcement.checkCompatibleTheme(ThemeEnforcement.java:131) at android.support.design.internal.ThemeEnforcement.obtainTintedStyledAttributes(ThemeEnforcement.java:110) at android.support.design.widget.BottomNavigationView.<init>(BottomNavigationView.java:138) at android.support.design.widget.BottomNavigationView.<init>(BottomNavigationView.java:114) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730) at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:863) at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:72) at android.view.LayoutInflater.rInflate(LayoutInflater.java:837) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824) at android.view.LayoutInflater.inflate(LayoutInflater.java:515) at android.view.LayoutInflater.inflate(LayoutInflater.java:394) Copy stack to clipboard
該当のソースコード
xml
<?xml version="1.0" encoding="utf-8"?><android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<android.support.design.widget.BottomNavigationView android:id="@+id/navigation" android:layout_width="0dp" android:layout_height="wrap_content" android:background="?android:attr/windowBackground" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toBottomOf="@+id/webView" app:menu="@menu/navigation" /> <WebView android:id="@+id/webView" android:layout_width="0dp" android:layout_height="0dp" android:layout_marginBottom="8dp" android:layout_marginEnd="8dp" android:layout_marginLeft="8dp" android:layout_marginRight="8dp" android:layout_marginStart="8dp" android:layout_marginTop="8dp" app:layout_constraintBottom_toTopOf="@+id/navigation" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>
試したこと
style.xmlは、Base.を追加し以下の様にしました。
<style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。