I created a navigation drawer in Android Studio. I removed action bar using parent="Theme.AppCompat.Light.NoActionBar"
The problem is that while running the application, the app is closing when the navigation drawer is opened.
What could be causing the crash?
Check your manifest:
<application
android:theme="@style/AppTheme">
<activity
android:theme="@style/AppTheme.NoActionBar" >
These are the styles that I am using in my app.
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
And this is the usage in manifest:
<activity
android:name=".activity.MainActivity"
android:label="@string/title_activity_main"
android:theme="@style/AppTheme.NoActionBar" />
Good luck with your app!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.