styles.xml

← Back

The file containing the source code shown below is located in the corresponding directory in <sdk>/samples/android-<version>/...

<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2007 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->

<resources>
    <!-- A custom theme that is a variation on the light them with a different
         background color. -->
    <color name="custom_theme_color">#b0b0ff</color>
    <style name="CustomTheme" parent="android:Theme.Light">
        <item name="android:windowBackground">@color/custom_theme_color</item>
        <item name="android:colorBackground">@color/custom_theme_color</item>
    </style>

    <!-- This is a theme that will adjust itself depending on the API version.
         The default definition is the safe one, using a theme that has always
         been defined.  Look at values-11/styles.xml for a variation that is
         selected when the holographic theme is available. -->
    <style name="ThemeHolo" parent="android:Theme">
    </style>

    <!-- Base application theme is the default theme. -->
    <style name="Theme" parent="android:Theme">
    </style>

    <!-- Variation on our application theme that forces a plain
        text style. -->
    <style name="Theme.PlainText">
        <item name="android:textAppearance">@style/TextAppearance.Theme.PlainText</item>
    </style>

    <!-- Variation on our application theme that has a black
         background. -->
    <style name="Theme.Black">
        <item name="android:windowBackground">@drawable/screen_background_black</item>
    </style>

    <!-- A theme for a custom dialog appearance.  Here we use an ugly
         custom frame. -->
    <style name="Theme.CustomDialog" parent="android:style/Theme.Dialog">
        <item name="android:windowBackground">@drawable/filled_box</item>
    </style>

    <!-- A theme that has a wallpaper background.  Here we explicitly specify
         that this theme is to inherit from the system's wallpaper theme,
         which sets up various attributes correctly. -->
    <style name="Theme.Wallpaper" parent="android:style/Theme.Wallpaper">
        <item name="android:colorForeground">#fff</item>
    </style>

    <!-- A theme that has a translucent background.  Here we explicitly specify
         that this theme is to inherit from the system's translucent theme,
         which sets up various attributes correctly. -->
    <style name="Theme.Translucent" parent="android:style/Theme.Translucent">
        <item name="android:windowBackground">@drawable/translucent_background</item>
        <item name="android:windowNoTitle">true</item>
        <item name="android:colorForeground">#fff</item>
    </style>

    <!-- Variation on our application theme that has a transparent
         background; this example completely removes the background,
         allowing the activity to decide how to composite.  Also here we
         force the translucency ourself rather than making use of the built-in
         translucent theme. -->
    <style name="Theme.Transparent">
        <item name="android:windowIsTranslucent">true</item>
        <item name="android:windowAnimationStyle">@android:style/Animation.Translucent</item>
        <item name="android:windowBackground">@drawable/transparent_background</item>
        <item name="android:windowNoTitle">true</item>
        <item name="android:colorForeground">#fff</item>
    </style>

    <style name="TextAppearance.Theme.PlainText" parent="android:TextAppearance.Theme">
        <item name="android:textStyle">normal</item>
    </style>

    <style name="ImageView120dpi">
        <item name="android:src">@drawable/stylogo120dpi</item>
        <item name="android:layout_width">wrap_content</item>
        <item name="android:layout_height">wrap_content</item>
    </style>

    <style name="ImageView160dpi">
        <item name="android:src">@drawable/stylogo160dpi</item>
        <item name="android:layout_width">wrap_content</item>
        <item name="android:layout_height">wrap_content</item>
    </style>

    <style name="ImageView240dpi">
        <item name="android:src">@drawable/stylogo240dpi</item>
        <item name="android:layout_width">wrap_content</item>
        <item name="android:layout_height">wrap_content</item>
    </style>
</resources>