tags:

views:

24

answers:

0

I am studying how to use styles and create theme in android. Please help to implement following.

I have listview displaying fixed image and variable text. I want to change the image based on theme selection. Is it possible to do that? How?

I can change background and text color using following code. Styles.xml

<style name="BlueLabel">
    <item name="android:textColor">#000</item>
    <item name="android:shadowDx">1.0</item>
    <item name="android:shadowDy">1.0</item>
    <item name="android:shadowRadius">1</item>
    <item name="android:shadowColor">#DDD</item>
    <item name="android:background">#FFD6D6D7</item>
</style>

Java code

this.setTheme(R.style.BlueLabel);

Here is code that i want to be theme specific

current code

ImageView image = (ImageView)curView.findViewById(R.id.ContactImage);
image.setImageResource(R.drawable.bw_contact);

I have another image R.drawable.blue_contact, which i want to load when bluelable style is applied.