Background Resource

XML Background file saved at:

res/
  background/
    background.xml
    background1.png
    background2.jpg
    background3.png

Resource reference

  • XML: @background/background
  • Java: Res.background.background

Background XML file saved at res/background/myBackground.xml:Example

This layout XML applies a background to a Button:

<Button background="@background/myBackground" />

This application code retrieves a background:

Background myBackground = ResManager.getBackground(Res.background.myBackground);