Custom themes and colors in android

user1730694

Can i define two completely different colors.xml for two different themes? For example in my case we use much more different colors in pallette that defined in theme by standart(android:colorPrimary, android:colorAccent, android:colorBackground etc). Hope, that my question is clear. If it's not, ask me in comments, please.

user1730694

Ok, after searching a bit I found a solution like this. Designer doesn't want to use colorPrimary etc, so I add my custom attribute in attrs like this :

<attr name="colorExperiment" format="color"/>

After this I add this attr in styles in theme like this:

 <style name="DarkTheme" parent="AppTheme.NoActionBar">
    <item name="android:windowAnimationStyle">@null</item>
    <item name="android:windowBackground">@color/onyx</item>
    <item name="colorExperiment">@color/onyx</item>
</style>

And use in layout for example:

<TextView
   android:id="@+id/auth_caption"
   android:includeFontPadding="false"
   android:layout_width="wrap_content"
   android:layout_height="wrap_content"
   android:layout_centerHorizontal="true"
   android:gravity="center"
   android:textSize="34dp"
   android:text="@string/auth_caption"
   android:textColor="?colorExperiment"
 />

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to use colors from android standard themes?

From Dev

Android Progress Custom Colors

From Dev

Android Use custom themes to modify style attributes

From Dev

Android: Custom colors in styles not working

From Dev

android: xml for default indeterminate Progressbar with custom colors

From Dev

Python Tkinter custom themes

From Dev

Python Tkinter custom themes

From Dev

Custom themes for dojox charting

From Dev

AS3 Multidimensional Vector of Colors Themes

From Dev

Mediterranean themes for Unity - Change input form colors

From Dev

iTerm 2 ZSH colors/themes not showed correctly

From Dev

Android appCompat themes vs Base themes

From Dev

Themes in Android are mixing

From Dev

Issue with AppCompat and Themes in Android

From Dev

Themes for Android and iOS development

From Dev

Downloadable Android app themes

From Dev

Nautilus ugly with custom GTK themes

From Dev

In Android, can apply different themes in a single XML layout's TextView at runtime without creating a custom widget?

From Dev

In Android, can apply different themes in a single XML layout's TextView at runtime without creating a custom widget?

From Dev

Android Compose Custom Theme colors - Text color not picking the theme color

From Dev

Android drawing an arc in custom view using sweep gradient with multiple colors

From Dev

How to change row colors in custom grid view android

From Dev

Colors in Android

From Dev

Android issue with implementing customised themes

From Dev

Android Studio problems switching themes

From Dev

Changing color themes in Android Studio

From Dev

How can I manually adjust menu colors in themes?

From Dev

How do I change the colors of the Ambiance & Radiance themes?

From Dev

custom colors in R Plotly

Related Related

  1. 1

    How to use colors from android standard themes?

  2. 2

    Android Progress Custom Colors

  3. 3

    Android Use custom themes to modify style attributes

  4. 4

    Android: Custom colors in styles not working

  5. 5

    android: xml for default indeterminate Progressbar with custom colors

  6. 6

    Python Tkinter custom themes

  7. 7

    Python Tkinter custom themes

  8. 8

    Custom themes for dojox charting

  9. 9

    AS3 Multidimensional Vector of Colors Themes

  10. 10

    Mediterranean themes for Unity - Change input form colors

  11. 11

    iTerm 2 ZSH colors/themes not showed correctly

  12. 12

    Android appCompat themes vs Base themes

  13. 13

    Themes in Android are mixing

  14. 14

    Issue with AppCompat and Themes in Android

  15. 15

    Themes for Android and iOS development

  16. 16

    Downloadable Android app themes

  17. 17

    Nautilus ugly with custom GTK themes

  18. 18

    In Android, can apply different themes in a single XML layout's TextView at runtime without creating a custom widget?

  19. 19

    In Android, can apply different themes in a single XML layout's TextView at runtime without creating a custom widget?

  20. 20

    Android Compose Custom Theme colors - Text color not picking the theme color

  21. 21

    Android drawing an arc in custom view using sweep gradient with multiple colors

  22. 22

    How to change row colors in custom grid view android

  23. 23

    Colors in Android

  24. 24

    Android issue with implementing customised themes

  25. 25

    Android Studio problems switching themes

  26. 26

    Changing color themes in Android Studio

  27. 27

    How can I manually adjust menu colors in themes?

  28. 28

    How do I change the colors of the Ambiance & Radiance themes?

  29. 29

    custom colors in R Plotly

HotTag

Archive