Mac Thomas
Mac Thomas

Reputation: 11

apply css, style or theme programmatically android

I am developing application in which I would like to...

  1. download css file from server and apply it the the activity layout file. or
  2. create string file for style or theme and apply it the the layout.

I have tried to find the solution on android site but there is no any way to to do so.

so, my question is that

is it possible to apply css file to android layout that is downloaded dynamically or is it possible to use string to set as a style or theme to android layout.

Upvotes: 1

Views: 562

Answers (1)

Budius
Budius

Reputation: 39836

No and No!

CSS are for web design, Android is something totally different.

Strings cannot be convert to a style, styles must be built as XML files on your project and compiled with the app. To change the themes you can call setTheme(int) method during onCreate of each activity.

edit:

from the activity:

getApplication().setTheme(int);

Upvotes: 1

Related Questions