tags:

views:

72

answers:

0

I know you can change buttons background by creating a simple XML file, like this:

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
    <item
        android:state_window_focused="false"
        android:state_enabled="true"
        android:drawable="@drawable/button_normal"
    />
    <!-- ... -->
</selection>

I was wondering if it is possible to use a similar approach to change the style attribute of an element using the same (or similar) technique.

Or, if that is not possible, how can the style attribute be changed during runtime (there is no such thing as button.setStyle(R.style.button)).