alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Android example source code file (styles.xml)

This example Android source code file (styles.xml) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Android by Example" TM.

Java - Android tags/keywords

animation, bb000000, dialogwindowtitle, ff000000, ff1b82eb, global, light, preference, standard, status, styles, textappearance, widget, windowtitlebackground

The styles.xml Android example source code

<?xml version="1.0" encoding="utf-8"?>
<!--
/*
 * Copyright (C) 2006-2008 Google Inc.
 *
 * 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>
    <!-- Global Theme Styles -->
    <eat-comment />
    

    <style name="WindowTitleBackground">
        <item name="android:background">@android:drawable/title_bar
    </style>

    <style name="WindowTitle">
        <item name="android:singleLine">true
        <item name="android:textAppearance">@style/TextAppearance.WindowTitle
        <item name="android:shadowColor">#BB000000
        <item name="android:shadowRadius">2.75
    </style>

    <style name="DialogWindowTitle">
        <item name="android:maxLines">1
        <item name="android:scrollHorizontally">true
        <item name="android:textAppearance">@style/TextAppearance.DialogWindowTitle
    </style>

    <style name="AlertDialog">
        <item name="fullDark">@android:drawable/popup_full_dark
        <item name="topDark">@android:drawable/popup_top_dark
        <item name="centerDark">@android:drawable/popup_center_dark
        <item name="bottomDark">@android:drawable/popup_bottom_dark
        <item name="fullBright">@android:drawable/popup_full_bright
        <item name="topBright">@android:drawable/popup_top_bright
        <item name="centerBright">@android:drawable/popup_center_bright
        <item name="bottomBright">@android:drawable/popup_bottom_bright
        <item name="bottomMedium">@android:drawable/popup_bottom_medium
        <item name="centerMedium">@android:drawable/popup_center_medium
    </style>
    
    <!-- Animations -->
    <style name="Animation" />
    
    <!-- Standard animations for a full-screen window or activity. -->
    <style name="Animation.Activity">
        <item name="activityOpenEnterAnimation">@anim/task_open_enter
        <item name="activityOpenExitAnimation">@anim/task_open_exit
        <item name="activityCloseEnterAnimation">@anim/task_close_enter
        <item name="activityCloseExitAnimation">@anim/task_close_exit
        <item name="taskOpenEnterAnimation">@anim/task_open_enter
        <item name="taskOpenExitAnimation">@anim/task_open_exit
        <item name="taskCloseEnterAnimation">@anim/task_close_enter
        <item name="taskCloseExitAnimation">@anim/task_close_exit
        <item name="taskToFrontEnterAnimation">@anim/task_open_enter
        <item name="taskToFrontExitAnimation">@anim/task_open_exit
        <item name="taskToBackEnterAnimation">@anim/task_close_enter
        <item name="taskToBackExitAnimation">@anim/task_close_exit
    </style>

    <!-- Standard animations for a non-full-screen window or activity. -->
    <style name="Animation.Dialog">
    </style>

    <!-- Standard animations for a translucent window or activity. -->
    <style name="Animation.Translucent">
    </style>

    <style name="Animation.OptionsPanel">
        <item name="windowEnterAnimation">@anim/options_panel_enter
        <item name="windowExitAnimation">@anim/options_panel_exit
    </style>

    <style name="Animation.SubMenuPanel">
        <item name="windowEnterAnimation">@anim/submenu_enter
        <item name="windowExitAnimation">@anim/submenu_exit
    </style>

    <style name="Animation.TypingFilter">
        <item name="windowEnterAnimation">@anim/grow_fade_in_center
        <item name="windowExitAnimation">@anim/shrink_fade_out_center
    </style>
    
    <style name="Animation.TypingFilterRestore">
        <item name="windowEnterAnimation">@null
        <item name="windowExitAnimation">@anim/shrink_fade_out_center
    </style>

    <style name="Animation.Toast">
        <item name="windowEnterAnimation">@anim/toast_enter
        <item name="windowExitAnimation">@anim/toast_exit
    </style>

    <style name="Animation.DropDownDown">
        <item name="windowEnterAnimation">@anim/grow_fade_in
        <item name="windowExitAnimation">@anim/shrink_fade_out
    </style>

    <style name="Animation.DropDownUp">
        <item name="windowEnterAnimation">@anim/grow_fade_in_from_bottom
        <item name="windowExitAnimation">@anim/shrink_fade_out_from_bottom
    </style>

    <!-- Status Bar Styles -->

    <style name="TextAppearance.StatusBarTitle">
        <item name="android:textSize">14sp
        <item name="android:textStyle">bold
        <item name="android:textColor">#ffffffff
    </style>


    <!-- Widget Styles -->

    <style name="Widget">
        <item name="android:textAppearance">?textAppearance
    </style>

    <style name="Widget.AbsListView">
        <item name="android:scrollbars">vertical
        <item name="android:fadingEdge">vertical
    </style>

    <style name="Widget.Button">
        <item name="android:background">@android:drawable/btn_default
        <item name="android:focusable">true
        <item name="android:clickable">true
        <item name="android:textAppearance">?android:attr/textAppearanceSmallInverse
        <item name="android:textColor">@android:color/primary_text_light_nodisable
        <item name="android:gravity">center_vertical|center_horizontal
    </style>

    <style name="Widget.Button.Small">
        <item name="android:background">@android:drawable/btn_default_small
    </style>

    <style name="Widget.Button.Inset">
        <item name="android:background">@android:drawable/button_inset
    </style>

    <style name="Widget.CompoundButton">
        <item name="android:focusable">true
        <item name="android:clickable">true
        <item name="android:textAppearance">?android:attr/textAppearance
        <item name="android:textColor">?android:attr/textColorPrimaryDisableOnly
        <item name="android:gravity">center_vertical|left
    </style>

    <style name="Widget.CompoundButton.CheckBox">
        <item name="android:background">@android:drawable/btn_check_label_background
        <item name="android:button">@android:drawable/btn_check
    </style>

    <style name="Widget.CompoundButton.RadioButton">
        <item name="android:background">@android:drawable/btn_radio_label_background
        <item name="android:button">@android:drawable/btn_radio
    </style>

    <style name="Widget.CompoundButton.Star">
        <item name="android:background">@android:drawable/btn_star_label_background
        <item name="android:button">@android:drawable/btn_star
    </style>

    <style name="Widget.Button.Toggle">
        <item name="android:background">@android:drawable/btn_toggle_bg
        <item name="android:textOn">@android:string/capital_on
        <item name="android:textOff">@android:string/capital_off
        <item name="android:disabledAlpha">?android:attr/disabledAlpha
    </style>

    <style name="Widget.ProgressBar">
        <item name="android:indeterminateOnly">true
        <item name="android:indeterminateDrawable">@android:drawable/progress_medium
        <item name="android:indeterminateBehavior">repeat
        <item name="android:indeterminateDuration">3500
        <item name="android:minWidth">48dip
        <item name="android:maxWidth">48dip
        <item name="android:minHeight">48dip
        <item name="android:maxHeight">48dip
    </style>

    <style name="Widget.ProgressBar.Large">
        <item name="android:indeterminateDrawable">@android:drawable/progress_large
        <item name="android:minWidth">76dip
        <item name="android:maxWidth">76dip
        <item name="android:minHeight">76dip
        <item name="android:maxHeight">76dip
    </style>
    
    <style name="Widget.ProgressBar.Small">
        <item name="android:indeterminateDrawable">@android:drawable/progress_small
        <item name="android:minWidth">16dip
        <item name="android:maxWidth">16dip
        <item name="android:minHeight">16dip
        <item name="android:maxHeight">16dip
    </style>

    <style name="Widget.ProgressBar.Small.Title">
        <item name="android:indeterminateDrawable">@android:drawable/progress_small_titlebar
    </style>

    <style name="Widget.ProgressBar.Horizontal">
        <item name="android:indeterminateOnly">false
        <item name="android:progressDrawable">@android:drawable/progress_horizontal
        <item name="android:indeterminateDrawable">@android:drawable/progress_indeterminate_horizontal
        <item name="android:minHeight">20dip
        <item name="android:maxHeight">20dip
    </style>

    <style name="Widget.SeekBar">
        <item name="android:indeterminateOnly">false
        <item name="android:progressDrawable">@android:drawable/progress_horizontal
        <item name="android:indeterminateDrawable">@android:drawable/progress_horizontal
        <item name="android:minHeight">20dip
        <item name="android:maxHeight">20dip
        <item name="android:thumb">@android:drawable/seek_thumb
        <item name="android:thumbOffset">8px
    </style>

    <style name="Widget.RatingBar">
        <item name="android:indeterminateOnly">false
        <item name="android:progressDrawable">@android:drawable/ratingbar_full
        <item name="android:indeterminateDrawable">@android:drawable/ratingbar_full
        <item name="android:minHeight">57dip
        <item name="android:maxHeight">57dip
        <item name="android:thumb">@null
    </style>

    <style name="Widget.RatingBar.Indicator">
        <item name="android:indeterminateOnly">false
        <item name="android:progressDrawable">@android:drawable/ratingbar
        <item name="android:indeterminateDrawable">@android:drawable/ratingbar
        <item name="android:minHeight">38dip
        <item name="android:maxHeight">38dip
        <item name="android:thumb">@null
        <item name="android:isIndicator">true
    </style>

    <style name="Widget.RatingBar.Small">
        <item name="android:indeterminateOnly">false
        <item name="android:progressDrawable">@android:drawable/ratingbar_small
        <item name="android:indeterminateDrawable">@android:drawable/ratingbar_small
        <item name="android:minHeight">14dip
        <item name="android:maxHeight">14dip
        <item name="android:thumb">@null
        <item name="android:isIndicator">true
    </style>

    <style name="Widget.TextView">
        <item name="android:textAppearance">?android:attr/textAppearanceSmall
    </style>
    
    <style name="Widget.TextView.ListSeparator">
        <item name="android:background">@android:drawable/settings_header
        <item name="android:layout_width">fill_parent
        <item name="android:layout_height">27dip
        <item name="android:textSize">18sp
        <item name="android:textColor">#FF000000
        <item name="android:gravity">center_vertical
        <item name="android:paddingLeft">5sp         
    </style>

    <style name="Widget.EditText">
        <item name="android:focusable">true
        <item name="android:focusableInTouchMode">true
        <item name="android:clickable">true
        <item name="android:background">@android:drawable/edit_text
        <item name="android:textAppearance">?android:attr/textAppearanceMediumInverse
        <item name="android:textColor">@android:color/primary_text_light
        <item name="android:gravity">center_vertical
    </style>
    
    <style name="Widget.ExpandableListView" parent="Widget.ListView">
        <item name="android:groupIndicator">@android:drawable/expander_group
        <item name="android:indicatorLeft">?android:attr/expandableListPreferredItemIndicatorLeft
        <item name="android:indicatorRight">?android:attr/expandableListPreferredItemIndicatorRight
        <item name="android:childDivider">@android:drawable/divider_horizontal_dark
    </style>

    <style name="Widget.ImageWell">
        <item name="android:background">@android:drawable/panel_picture_frame_background
    </style>

    <style name="Widget.ImageButton">
        <item name="android:focusable">true
        <item name="android:clickable">true
        <item name="android:scaleType">center
        <item name="android:background">@android:drawable/btn_default
    </style>

    <style name="Widget.AutoCompleteTextView">
        <item name="android:focusable">true
        <item name="android:focusableInTouchMode">true
        <item name="android:clickable">true
        <item name="android:background">@android:drawable/edit_text
        <item name="android:completionHintView">@android:layout/simple_dropdown_hint
        <item name="android:textAppearance">?android:attr/textAppearanceMediumInverse
        <item name="android:gravity">center_vertical
        <item name="android:completionThreshold">2
        <item name="android:dropDownSelector">@android:drawable/list_selector_background
        <item name="android:popupBackground">@android:drawable/spinner_dropdown_background
        <item name="android:dropDownVerticalOffset">-8px
        <item name="android:dropDownHorizontalOffset">2px
    </style>

    <style name="Widget.Spinner">
        <item name="android:background">@android:drawable/btn_dropdown
        <item name="android:clickable">true
    </style>

    <style name="Widget.TextView.PopupMenu">
        <item name="android:clickable">true
        <item name="android:textAppearance">@style/TextAppearance.Widget.TextView.PopupMenu
    </style>

    <style name="Widget.TextView.SpinnerItem">
        <item name="android:textAppearance">@style/TextAppearance.Widget.TextView.SpinnerItem
    </style>

    <style name="Widget.DropDownItem">
        <item name="android:textAppearance">@style/TextAppearance.Widget.DropDownItem
        <item name="android:paddingLeft">6dip
        <item name="android:paddingRight">6dip
        <item name="android:gravity">center_vertical
    </style>
    
    <style name="Widget.DropDownItem.Spinner">
        <item name="android:checkMark">@android:drawable/btn_radio
    </style>

    <style name="Widget.ScrollView">
        <item name="android:scrollbars">vertical
        <item name="android:fadingEdge">vertical
    </style>

    <style name="Widget.ListView" parent="Widget.AbsListView">
        <item name="android:listSelector">@android:drawable/list_selector_background
        <item name="android:cacheColorHint">?android:attr/colorBackground
        <item name="android:divider">@android:drawable/divider_horizontal_dark
    </style>
    
    <style name="Widget.ListView.White" parent="Widget.AbsListView">
        <item name="android:listSelector">@android:drawable/list_selector_background
        <item name="android:background">@android:color/white
        <item name="android:divider">@android:drawable/divider_horizontal_bright
    </style>    

    <style name="Widget.ListView.DropDown">
    	<item name="android:cacheColorHint">@null
        <item name="android:divider">@android:drawable/divider_horizontal_bright
    </style>

    <style name="Widget.ListView.Menu">
		<item name="android:cacheColorHint">@null
        <item name="android:scrollbars">vertical
        <item name="android:fadingEdge">vertical
        <item name="listSelector">@android:drawable/menu_selector
        <!-- Light background for the list in menus, so the divider for bright themes -->
        <item name="android:divider">@android:drawable/divider_horizontal_bright
    </style>

    <style name="Widget.GridView" parent="Widget.AbsListView">
        <item name="android:listSelector">@android:drawable/grid_selector_background
    </style>

    <style name="Widget.WebView">
        <item name="android:focusable">true
        <item name="android:scrollbars">horizontal|vertical
    </style>

    <style name="Widget.TabWidget">
        <item name="android:textAppearance">@style/TextAppearance.Widget.TabWidget
        <item name="ellipsize">marquee
        <item name="singleLine">true
    </style>

    <style name="Widget.Gallery">
        <item name="android:fadingEdge">horizontal
        <item name="android:gravity">center_vertical
        <item name="android:spacing">-20px
        <item name="android:unselectedAlpha">0.85
    </style>
    
    <style name="Widget.PopupWindow">
        <item name="android:popupBackground">@android:drawable/editbox_dropdown_background_dark
    </style>

    <!-- Text Appearances -->
    <eat-comment />

    <style name="TextAppearance">
        <item name="android:textColor">?textColorPrimary
        <item name="android:textColorHighlight">#FF1B82EB
        <item name="android:textColorHint">?textColorHint
        <item name="android:textColorLink">#5C5CFF
        <item name="android:textSize">16sp
        <item name="android:textStyle">normal
    </style>

    <style name="TextAppearance.Inverse">
        <item name="textColor">?textColorPrimaryInverse
        <item name="android:textColorHint">?textColorHintInverse
        <item name="android:textColorLink">#0000EE
    </style>

    <style name="TextAppearance.Theme">
    </style>

    <style name="TextAppearance.DialogWindowTitle">
        <item name="android:textSize">18sp
        <item name="android:textStyle">normal
        <item name="android:textColor">?textColorPrimary
    </style>

    <style name="TextAppearance.Large">
        <item name="android:textSize">22sp
        <item name="android:textStyle">normal
        <item name="android:textColor">?textColorPrimary
    </style>

    <style name="TextAppearance.Large.Inverse">
        <item name="android:textColor">?textColorPrimaryInverse
        <item name="android:textColorHint">?textColorHintInverse
    </style>

    <style name="TextAppearance.Medium">
        <item name="android:textSize">18sp
        <item name="android:textStyle">normal
        <item name="android:textColor">?textColorPrimary
    </style>

    <style name="TextAppearance.Medium.Inverse">
        <item name="android:textColor">?textColorPrimaryInverse
        <item name="android:textColorHint">?textColorHintInverse
    </style>

    <style name="TextAppearance.Small">
        <item name="android:textSize">14sp
        <item name="android:textStyle">normal
        <item name="android:textColor">?textColorSecondary
    </style>

    <style name="TextAppearance.Small.Inverse">
        <item name="android:textColor">?textColorSecondaryInverse
        <item name="android:textColorHint">?textColorHintInverse
    </style>

    <style name="TextAppearance.Theme.Dialog" parent="TextAppearance.Theme">
    </style>

    <style name="TextAppearance.Theme.Dialog.AppError">
        <item name="android:textColor">#ffffc0c0
    </style>

    <style name="TextAppearance.Widget">
    </style>

    <style name="TextAppearance.Widget.Button" parent="TextAppearance.Small.Inverse">
        <item name="android:textColor">@android:color/primary_text_light_nodisable
    </style>

    <style name="TextAppearance.Widget.IconMenu.Item" parent="TextAppearance.Small">
        <item name="android:textColor">?textColorPrimaryInverse
    </style>

    <style name="TextAppearance.Widget.EditText">
        <item name="android:textColor">@color/widget_edittext_dark
        <item name="android:textColorHint">@android:color/hint_foreground_light
    </style>

    <style name="TextAppearance.Widget.TabWidget">
        <item name="android:textSize">14sp
        <item name="android:textStyle">normal
        <item name="android:textColor">@android:color/tab_indicator_text
    </style>
    
    <style name="TextAppearance.Widget.TextView">
        <item name="android:textColor">?textColorPrimaryDisableOnly
        <item name="android:textColorHint">?textColorHint
    </style>

    <style name="TextAppearance.Widget.TextView.PopupMenu">
        <item name="android:textSize">18sp
        <item name="android:textColor">?textColorPrimaryDisableOnly
        <item name="android:textColorHint">?textColorHint
    </style>

    <style name="TextAppearance.Widget.DropDownHint">
        <item name="android:textColor">?textColorPrimaryInverse
        <item name="android:textSize">14sp
    </style>

    <style name="TextAppearance.Widget.DropDownItem">
        <item name="android:textColor">@android:color/primary_text_light_disable_only
    </style>

    <style name="TextAppearance.Widget.TextView.SpinnerItem">
        <item name="android:textColor">@android:color/primary_text_light_disable_only
    </style>

    <style name="TextAppearance.WindowTitle">
        <item name="android:textColor">#fff
        <item name="android:textSize">14sp
        <item name="android:textStyle">bold
    </style>

    <style name="MediaButton">
        <item name="android:background">@android:drawable/media_button_background
        <item name="android:layout_width">71px
        <item name="android:layout_height">52px
    </style>

    <style name="MediaButton.Previous">
        <item name="android:src">@android:drawable/ic_media_previous
    </style>

    <style name="MediaButton.Next">
        <item name="android:src">@android:drawable/ic_media_next
    </style>

    <style name="MediaButton.Play">
        <item name="android:src">@android:drawable/ic_media_play
    </style>

    <style name="MediaButton.Ffwd">
        <item name="android:src">@android:drawable/ic_media_ff
    </style>

    <style name="MediaButton.Rew">
        <item name="android:src">@android:drawable/ic_media_rew
    </style>

    <style name="MediaButton.Pause">
        <item name="android:src">@android:drawable/ic_media_pause
    </style>

    <!-- Preference Styles -->

    <style name="Preference">
        <item name="android:layout">@android:layout/preference
    </style>
    
    <style name="Preference.Information">
        <item name="android:layout">@android:layout/preference_information
        <item name="android:enabled">false
        <item name="android:shouldDisableView">false
    </style>
    
    <style name="Preference.Category">
        <item name="android:layout">@android:layout/preference_category
        <!-- The title should not dim if the category is disabled, instead only the preference children should dim. -->
        <item name="android:shouldDisableView">false
        <item name="android:selectable">false
    </style>
    
    <style name="Preference.CheckBoxPreference">
        <item name="android:widgetLayout">@android:layout/preference_widget_checkbox
    </style>
    
    <style name="Preference.PreferenceScreen">
        <item name="android:widgetLayout">@android:layout/preferences
    </style>

    <style name="Preference.DialogPreference">
        <item name="android:positiveButtonText">@android:string/ok
        <item name="android:negativeButtonText">@android:string/cancel
    </style>
    
    <style name="Preference.DialogPreference.YesNoPreference">
        <item name="android:positiveButtonText">@android:string/yes
        <item name="android:negativeButtonText">@android:string/no
    </style>
    
    <style name="Preference.DialogPreference.EditTextPreference">
        <item name="android:dialogLayout">@android:layout/preference_dialog_edittext
    </style>
    
    <style name="Preference.RingtonePreference">
        <item name="android:ringtoneType">ringtone
        <item name="android:showSilent">true
        <item name="android:showDefault">true
    </style>
    
</resources>

Other Android examples (source code examples)

Here is a short list of links related to this Android styles.xml source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.