user8341034
user8341034

Reputation:

can I use different themes on different activity screens

on my create screen, the nav bar is black instead of this pinky colour I made it to be. I don't really know what's the issue

styles.xml

    <resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <!-- 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="CreateTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <!-- Customize your theme here. -->
        <item name="colorAccent">@color/colorCreate</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    </style>

</resources>

manifest code

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

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true">

        <activity
            android:name=".MainActivity"
            android:screenOrientation="portrait"
            android:theme="@style/AppTheme">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <activity
            android:name=".create"
            android:theme="@style/CreateTheme"/>

        <activity android:name=".view" />
        <activity android:name=".settings"></activity>

        <meta-data
            android:name="preloaded_fonts"
            android:resource="@array/preloaded_fonts" />
    </application>

</manifest>

I tried taking android:theme"@style/AppTheme" and putting it under the tag but no difference.

Upvotes: 1

Views: 958

Answers (1)

Tohu
Tohu

Reputation: 151

I assume you mean the toolbar (bar at the top of screen) when you say nav bar. By default, the toolbar color is the same as colorPrimary if the toolbar was generated for you. Check that the toolbar has android:background="?attr/colorPrimary" inside of it then change the primary color with your custom color.

<style name="CreateTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorCreate</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
</style>

Upvotes: 2

Related Questions