Search code examples
androidandroid-appcompatbottomnavigationview

Using BottomNavigationView with a no Theme.AppCompat


i need to use the theme

android:theme="@android:style/Theme.Holo.NoActionBar.Fullscreen"

in an activity where there is a

android.support.design.widget.BottomNavigationView

but everytime i run the app it crashes because BottomNavigationView need Theme.AppCompat. How can i fix this?

My Manifest:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="tfdev.avventuratestuale">

    <application
        android:name=".Main.MyApplication"
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@android:style/Theme.Holo.NoActionBar.Fullscreen">
    <activity android:name=".Main.Main.menu_principale"
            android:theme="@android:style/Theme.Holo.NoActionBar.Fullscreen">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name=".Main.Main.scene_manager"
            android:theme="@style/Theme.AppCompat"
            ></activity>
    </application>

</manifest>

BottomNavigationView activity:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@layout/main_background">

    <android.support.design.widget.BottomNavigationView
        android:id="@+id/bottom_navigation"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        app:itemBackground="@color/colorPrimary"
        app:itemIconTint="#FFFFFF"
        app:itemTextColor="#FFFFFF"
        app:menu="@menu/bottom_navigation_main" />

</RelativeLayout>

BottomNavigation Activity:

public class scene_manager extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        View decorView = getWindow().getDecorView();
        int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
        decorView.setSystemUiVisibility(uiOptions);
        setContentView(R.layout.activity_scene_manager);



    }

Solution

  • I've fixed adding

    requestWindowFeature(Window.FEATURE_NO_TITLE);
    this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    

    in all the activity