user1017674 user1017674 - 1 year ago 69
Android Question

Specify text color for an included layout android

I have a Layout that is used in couple different places.

This layout itself has a textview, some buttons and a progressbar.

<LinearLayout id="reuse">

// in other places

<include layout="reuse"/> // text color blue here

// in other places

<include layout="reuse" /> //text color gree here

Now, depending on where the layout is included, i want to specify a different text color for the textview.

How can this be done? I tried specifying textcolor in the include that doesn't seem to help?

Answer Source

The only way I can think of doing this is programmatically, just use the reference of linear layout "reuse" and get the textview from it using reuse.findViewById() and manipulating the properties yourself.