In my app I have a Main Activity with a drawer layout to navigate between two fragments. One of those fragments has a FAB which opens another activity that extends from AppCompatActivity. This activity shows no lower toolbar, and an upper toolbar in grey. I managed to add a lower toolbar in the xml code :
<android.support.v7.widget.Toolbar
android:id="@+id/editor_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:minHeight="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
app:title="Add Manual Entry"/>
but the upper toolbar keeps showing in grey no matter what. Tried setting the upper toolbar to my colorPrimaryDark as a workaround but found no way to do it. I looked into my AppTheme and found this:
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:statusBarColor">@android:color/transparent</item>
</style>
Seeing as the parent says no action bar, I tried changing it to Theme.AppCompat.Light but I get this error on my main activity:
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.tobias.run/com.example.tobias.run.MainActivity}: java.lang.IllegalStateException: This Activity already has an action bar supplied by the window decor. Do not request Window.FEATURE_SUPPORT_ACTION_BAR and set windowActionBar to false in your theme to use a Toolbar instead.
which looks like my MainActivity and its drawer layout require the NoActionBar theme, altough I'm not sure. Why does my secondary activity doesn't come with a toolbar? how can I add one?
PS: Both the secondary activity code and xml are just as how Android Studio created them with the empty activity template. the xml just had the toolbar added.