I’m a beginner in android studio and was trying to create my first project but Action bar is not visible in new Android Studio version. Please suggest some ways so that I can show the action bar in my android project.
All the elements are visible except the action bar.
I just want to show the action bar in my android project.
Question posted in Android Studio
The official documentation can be found here.
The official documentation can be found here.
2
Answers
You have to add it to your layout. This is the code for a general Toolbar. How you add it to your layout, depends on the root layout you use (
CoordinatorLayout
,FrameLayout
,LinearLayout
, …).Please check if you are using the correct theme.
Try with
Theme.AppCompat.DayNight.DarkActionBar
or similar themes with actionbar instead of your current theme. eg:Theme.AppCompat.Light.NoActionBar
Kindly check your theme in themes.xml file, see the example below
<style name="AppTheme" parent="Theme.AppCompat.DayNight.DarkActionBar"/>