Take the 2-minute tour ×

I'm currently developing an app which should be totally customizable by endusers. Imagine the application has many activities with some TextViews, Buttons, etc.

So the client can create a XML file like this one:

<style >

As you can imagine, for example, there are several TextViews which are always "titles" so they should always take this h1 value.

I know I can parse this XML file and for each textview, apply this style manually, but this is not a good way of achieving this because if I had 3000 textViews, I should manually edit them all.

What I want is to "edit" the actual Style programmatically.

Any tip?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

You can't access a resource file in the created APK as they are compiled into it. So your idea to "customizable" styles works only in the following scenario:

  1. your app is a library project
  2. your client uses that library project and create a style which extends/overwrites your own style and compile that into a new APK

You are not clearly telling us if the "enduser" is a user of your app/apk or a customer that can do the above mentioned modifications.

An alternative might be to create your own extensions of TextViews, Buttons etc which can load your style set. You need to create your own style language for that and you need to make sure that the custom views understand and apply them.

A lot of work, if you ask me... I would, in general, suggest to make different themes so that the customer can pick the best suited for them...

share|improve this answer
the user can only provide a XML file. –  Sergi Castellsagué Millán Jul 15 '13 at 10:29
Well you still need to implement the "apply xml to view" feature by yourself as the normal styles can't be loaded on runtime. –  WarrenFaith Jul 15 '13 at 11:00

Your Answer


