Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

503
Views
Jetpack Compose theming: difference between XML theme file and Kotlin theme file

I'm a Android beginner and I'm getting started with Jetpack Compose. I'm confused about these two set files created by new Compose project template: themes.xml vs Theme.kt, and colors.xml vs Color.kt. Both colors.xml and Color.kt contain color definitions, and both themes.xml and Theme.kt contain primary color definition.

What's the difference between the XML file and the Kotlin file? Am I supposed to manually sync their contents?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

What's the difference between the XML file and the Kotlin file?

By default, android uses the XML files for setting the theme ... If you are using the compose (which is obviously you are doing) then you need to set theme like this

 setContent {
      AppThemeName { //AppThemeName is the name of your theme .. its autogenerated at the beginning by AppName+Theme
       
        }
 } 

Compose uses Theme.kt to get the theme information and similarly Color.kt for colors

Am I supposed to manually sync their contents?

No, But It depends ... generally if you are using only compose throughout your app then you don't need to manually sync the XML file since the Theme.kt file has the theme information that you will be using.

But there are cases where you need to mention some attributes in theme.xml for example windowSplashScreenAnimatedIcon, statusBarColor which cant be defined by default in compose Theme.kt

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!