Look the image:
image: enter image description here
I don’t know what code this is caused by. That’s why I will only share themes.xml codes.
//Themes.xml
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Base.Theme.TitleBarSettings" parent="Theme.Material3.DayNight.NoActionBar">
<!-- Customize your light theme here. -->
<!-- <item name="colorPrimary">@color/my_light_primary</item> -->
</style>
<style name="Theme.TitleBarSettings" parent="Base.Theme.TitleBarSettings" />
</resources>
2
Answers
You have set NoActionBar theme. Thats why it is not appearing.
use this as your parent theme:
It will have actionbar with the app name but it will not have 3 dotted menu on the right side.
For changing the color of the ActionBar add following code in your onCreate of the mainActivity.
You can change the "#0F9D58" to any color code you want.
there is another way to add a default toolbar to your app while setting your parent theme same as:
activity_main.xml
by following this approach you don’t need to change background color from the java code but you can easily change background color as a simple attribute of toolbar.
MainActivity.class
see the official documentation here :
https://developer.android.com/develop/ui/views/components/appbar/setting-up