How to reference a style in a custom theme

I have a login screen that is branded differently for different builds of my application. I need the background image to be different in the layout file for this screen, so I want to point to a different style for the top level container. I’m a bit at a loss at how to do this.

I have declared a styleable something like:

  • Android build failing with build.xml:479: SDK does not have any Build Tools installed
  • How does Dolphin web browser get notified when it's being uninstalled?
  • Android Studio says “cannot resolve symbol” but project compiles
  • Backup/restore sqlite db in android
  • How can I detect a click on the ActionBar title?
  • Determine addAction click for Android notifications
  • <resources>
    
        <declare-styleable name="ThemeBase">
           <attr name="loginPageContainerStyle" format="reference" />
        </declare-styleable>
    
    </resources>
    

    I have several different themes for the application, as such:

    <resources>
    
        <style name="ThemeBase" parent="android:style/Theme.Light" />
    
        <style name="ThemeOne" parent="ThemeBase">
           <item name="loginPageContainerStyle">@style/loginPageContainerThemeOne</item>
        </style>
    
        <style name="ThemeTwo" parent="ThemeBase">
           <item name="loginPageContainerStyle">@style/loginPageContainerThemeTwo</item>
        </style>
    
    </resources>
    

    And I have defined the following styles:

    <resources>
        <style name="loginPageContainerThemeOne">
            <item name="android:background">@drawable/background_theme_one</item>
        </style>
    
        <style name="loginPageContainerThemeTwo">
            <item name="android:background">@drawable/background_theme_two</item>
        </style>
    </resources>
    

    And finally a login.xml file something like:

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/loginRoot"
        style= [ ? WHAT GOES HERE ? ]
        android:gravity="center_horizontal"
        android:orientation="horizontal">
    
        [ LAYOUT STUFF ... ]
    
    </LinearLayout>
    

    Am I doing anything wrong? Can this be done this way?

    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.