很多朋友都找不到Android2.2中系统自带主题的源代码,因此对它并不熟悉,更谈不上在它的基础上进行熟练的修改了,下面是它的源代码,大家可以参考。
java代码:
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2006 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>
<!-- The default system theme. This is the theme used for activities
that have not explicitly set their own theme.
You can count on this being a dark
background with light text on top, but should try to make no
other assumptions about its appearance. In particular, the text
inside of widgets using this theme may be completely different,
with the widget container being a light color and the text on top
of it a dark color.
-->
<STYLE name="Theme">
<item name="colorForeground">@android:color/bright_foreground_dark</item>
<item name="colorForegroundInverse">@android:color/bright_foreground_dark_inverse</item>
<item name="colorBackground">@android:color/background_dark</item>
<item name="colorBackgroundCacheHint">?android:attr/colorbackground</item>
<item name="disabledAlpha">0.5</item>
<item name="backgroundDimAmount">0.6</item>
<!-- Text styles -->
<item name="textAppearance">@android:style/textappearance</item>
<item name="textAppearanceInverse">@android:style/textappearance.inverse</item>
<item name="textColorPrimary">@android:color/primary_text_dark</item>
<item name="textColorSecondary">@android:color/secondary_text_dark</item>
<item name="textColorTertiary">@android:color/tertiary_text_dark</item>
<item name="textColorPrimaryInverse">@android:color/primary_text_light</item>
<item name="textColorSecondaryInverse">@android:color/secondary_text_light</item>
<item name="textColorTertiaryInverse">@android:color/tertiary_text_light</item>
<itemname="textColorPrimaryDisableOnly">@android:color/primary_text_dark_disable_only</item>
<item name="textColorPrimaryInverseDisableOnly">@android:color/primary_text_light_disable_only</item>
<item name="textColorPrimaryNoDisable">@android:color/primary_text_dark_nodisable</item>
<item name="textColorSecondaryNoDisable">@android:color/secondary_text_dark_nodisable</item>
<item name="textColorPrimaryInverseNoDisable">@android:color/primary_text_light_nodisable</item>
<item name="textColorSecondaryInverseNoDisable">@android:color/secondary_text_light_nodisable
</item>
<item name="textColorHint">@android:color/hint_foreground_dark</item>
<item name="textColorHintInverse">@android:color/hint_foreground_light</item>
<item name="textColorSearchUrl">@android:color/search_url_text</item>
<item name="textAppearanceLarge">@android:style/textappearance.large</item>
<item name="textAppearanceMedium">@android:style/textappearance.medium</item>
<item name="textAppearanceSmall">@android:style/textappearance.small</item>
<item name="textAppearanceLargeInverse">@android:style/textappearance.large.inverse</item>
<item name="textAppearanceMediumInverse">@android:style/textappearance.medium.inverse</item>
<item name="textAppearanceSmallInverse">@android:style/textappearance.small.inverse</item>
<item name="textAppearanceSearchResultTitle">@android:style/textappearance.searchresult.title</item>
<item name="textAppearanceSearchResultSubtitle">@android:style/textappearance.searchresult.subtitle</item>
<item name="textAppearanceButton">@android:style/textappearance.widget.button</item>
<item name="candidatesTextStyleSpans">@android:string/candidates_style</item>
<item name="textCheckMark">@android:drawable/indicator_check_mark_dark</item>
<item name="textCheckMarkInverse">@android:drawable/indicator_check_mark_light</item>
<!-- Button styles -->
<item name="buttonStyle">@android:style/widget.button</item>
<item name="buttonStyleSmall">@android:style/widget.button.small</item>
<item name="buttonStyleInset">@android:style/widget.button.inset</item>
<item name="buttonStyleToggle">@android:style/widget.button.toggle</item>
<!-- List attributes -->
<item name="listPreferredItemHeight">64dip</item>
<!-- @hide -->
<item name="searchResultListItemHeight">58dip</item>
<item name="listDivider">@drawable/divider_horizontal_dark</item>
<item name="listSeparatorTextViewStyle">@android:style/widget.textview.listseparator</item>
<item name="listChoiceIndicatorSingle">@android:drawable/btn_radio</item>
<item name="listChoiceIndicatorMultiple">@android:drawable/btn_check</item>
<item name="expandableListPreferredItemPaddingLeft">40dip</item>
<item name="expandableListPreferredChildPaddingLeft">
<android:attr/expandablelistpreferreditempaddingleft</item>
<item name="expandableListPreferredItemIndicatorLeft">3dip</item>
<item name="expandableListPreferredItemIndicatorRight">33dip</item>
<item name="expandableListPreferredChildIndicatorLeft">
<android:attr/expandablelistpreferreditemindicatorleft</item>
<item name="expandableListPreferredChildIndicatorRight">
<android:attr/expandablelistpreferreditemindicatorright</item>
<!-- Gallery attributes -->
<item name="galleryItemBackground">@android:drawable/gallery_item_background</item>
<!-- Window attributes -->
<item name="windowBackground">@android:drawable/screen_background_dark</item>
<item name="windowFrame">@null</item>
<item name="windowNoTitle">false</item>
<item name="windowFullscreen">false</item>
<item name="windowIsFloating">false</item>
<item name="windowContentOverlay">@android:drawable/title_bar_shadow</item>
<item name="windowShowWallpaper">false</item>
<item name="windowTitleStyle">@android:style/windowtitle</item>
<item name="windowTitleSize">25dip</item>
<item name="windowTitleBackgroundStyle">@android:style/windowtitlebackground</item>
<item name="android:windowAnimationStyle">@android:style/animation.activity</item>
<item name="android:windowSoftInputMode">stateunspecified|adjustunspecified</item>
<!-- Dialog attributes -->
<item name="alertDialogStyle">@android:style/alertdialog</item>
<!-- Panel attributes -->
<item name="panelBackground">@android:drawable/menu_background</item>
<item name="panelFullBackground">@android:drawable/menu_background_fill_parent_width</item>
<item name="panelColorBackground">#fff</item>
<item name="panelColorForeground">?android:attr/textcolorprimaryinverse</item>
<item name="panelTextAppearance">?android:attr/textappearanceinverse</item>
<!-- Scrollbar attributes -->
<item name="scrollbarFadeDuration">250</item>
<item name="scrollbarDefaultDelayBeforeFade">300</item>
<item name="scrollbarSize">10dip</item>
<item name="scrollbarThumbHorizontal">@android:drawable/scrollbar_handle_horizontal</item>
<item name="scrollbarThumbVertical">@android:drawable/scrollbar_handle_vertical</item>
<item name="scrollbarTrackHorizontal">@null</item>
<item name="scrollbarTrackVertical">@null</item>
<!-- Widget styles -->
<item name="absListViewStyle">@android:style/widget.abslistview</item>
<item name="autoCompleteTextViewStyle">@android:style/widget.autocompletetextview</item>
<item name="checkboxStyle">@android:style/widget.compoundbutton.checkbox</item>
<item name="dropDownListViewStyle">@android:style/widget.listview.dropdown</item>
<item name="editTextStyle">@android:style/widget.edittext</item>
<item name="expandableListViewStyle">@android:style/widget.expandablelistview</item>
<item name="expandableListViewWhiteStyle">@android:style/widget.expandablelistview.white</item>
<item name="galleryStyle">@android:style/widget.gallery</item>
<item name="gestureOverlayViewStyle">@android:style/widget.gestureoverlayview</item>
<item name="gridViewStyle">@android:style/widget.gridview</item>
<item name="imageButtonStyle">@android:style/widget.imagebutton</item>
<item name="imageWellStyle">@android:style/widget.imagewell</item>
<item name="listViewStyle">@android:style/widget.listview</item>
<item name="listViewWhiteStyle">@android:style/widget.listview.white</item>
<item name="popupWindowStyle">@android:style/widget.popupwindow</item>
<item name="progressBarStyle">@android:style/widget.progressbar</item>
<item name="progressBarStyleHorizontal">@android:style/widget.progressbar.horizontal</item>
<item name="progressBarStyleSmall">@android:style/widget.progressbar.small</item>
<item name="progressBarStyleSmallTitle">@android:style/widget.progressbar.small.title</item>
<item name="progressBarStyleLarge">@android:style/widget.progressbar.large</item>
<item name="progressBarStyleInverse">@android:style/widget.progressbar.inverse</item>
<item name="progressBarStyleSmallInverse">@android:style/widget.progressbar.small.inverse</item>
<item name="progressBarStyleLargeInverse">@android:style/widget.progressbar.large.inverse</item>
<item name="seekBarStyle">@android:style/widget.seekbar</item>
<item name="ratingBarStyle">@android:style/widget.ratingbar</item>
<item name="ratingBarStyleIndicator">@android:style/widget.ratingbar.indicator</item>
<item name="ratingBarStyleSmall">@android:style/widget.ratingbar.small</item>
<item name="radioButtonStyle">@android:style/widget.compoundbutton.radiobutton</item>
<item name="scrollViewStyle">@android:style/widget.scrollview</item>
<item name="horizontalScrollViewStyle">@android:style/widget.horizontalscrollview</item>
<item name="spinnerStyle">@android:style/widget.spinner</item>
<item name="starStyle">@android:style/widget.compoundbutton.star</item>
<item name="tabWidgetStyle">@android:style/widget.tabwidget</item>
<item name="textViewStyle">@android:style/widget.textview</item>
<item name="webTextViewStyle">@android:style/widget.webtextview</item>
<item name="webViewStyle">@android:style/widget.webview</item>
<item name="dropDownItemStyle">@android:style/widget.dropdownitem</item>
<item name="spinnerDropDownItemStyle">@android:style/widget.dropdownitem.spinner</item>
<item name="spinnerItemStyle">@android:style/widget.textview.spinneritem</item>
<item name="dropDownHintAppearance">@android:style/textappearance.widget.dropdownhint</item>
<item name="keyboardViewStyle">@android:style/widget.keyboardview</item>
<item name="quickContactBadgeStyleWindowSmall">@android:style/widget.quickcontactbadge.windowsmall</item>
<item name="quickContactBadgeStyleWindowMedium">@android:style/widget.quickcontactbadge.windowmedium</item>
<item name="quickContactBadgeStyleWindowLarge">@android:style/widget.quickcontactbadge.windowlarge</item>
<item name="quickContactBadgeStyleSmallWindowSmall">@android:style/widget.quickcontactbadgesmall.windowsmall</item>
<item name="quickContactBadgeStyleSmallWindowMedium">@android:style/widget.quickcontactbadgesmall.windowmedium</item>
<item name="quickContactBadgeStyleSmallWindowLarge">@android:style/widget.quickcontactbadgesmall.windowlarge</item>
<!-- Preference styles -->
<item name="preferenceScreenStyle">@android:style/preference.preferencescreen</item>
<item name="preferenceCategoryStyle">@android:style/preference.category</item>
<item name="preferenceStyle">@android:style/preference</item>
<item name="preferenceInformationStyle">@android:style/preference.information</item>
<item name="checkBoxPreferenceStyle">@android:style/preference.checkboxpreference</item>
<item name="yesNoPreferenceStyle">@android:style/preference.dialogpreference.yesnopreference</item>
<item name="dialogPreferenceStyle">@android:style/preference.dialogpreference</item>
<item name="editTextPreferenceStyle">@android:style/preference.dialogpreference.edittextpreference</item>
<item name="ringtonePreferenceStyle">@android:style/preference.ringtonepreference</item>
<item name="preferenceLayoutChild">@android:layout/preference_child</item>
<!-- Search widget styles -->
<item name="searchWidgetCorpusItemBackground">@android:color/search_widget_corpus_item_background</item>
</STYLE>
<!-- Variant of the default (dark) theme with no title bar -->
<STYLE name="Theme.NoTitleBar">
<item name="android:windowNoTitle">true</item>
</STYLE>
<!-- Variant of the default (dark) theme that has no title bar and fills the entire screen -->
<STYLE name="Theme.NoTitleBar.Fullscreen">
<item name="android:windowFullscreen">true</item>
<item name="android:windowContentOverlay">@null</item>
</STYLE>
<!-- Theme for a light background with dark text on top. Set your activity
to this theme if you would like such an appearance. As with the
default theme, you should try to assume little more than that the
background will be a light color. -->
<STYLE name="Theme.Light">
<item name="windowBackground">@drawable/screen_background_light</item>
<item name="colorBackground">@android:color/background_light</item>
<item name="colorForeground">@color/bright_foreground_light</item>
<item name="colorForegroundInverse">@android:color/bright_foreground_light_inverse</item>
<item name="textColorPrimary">@android:color/primary_text_light</item>
<item name="textColorSecondary">@android:color/secondary_text_light</item>
<item name="textColorTertiary">@android:color/tertiary_text_light</item>
<item name="textColorPrimaryInverse">@android:color/primary_text_dark</item>
<item name="textColorSecondaryInverse">@android:color/secondary_text_dark</item>
<item name="textColorTertiaryInverse">@android:color/tertiary_text_dark</item>
<item name="textColorPrimaryDisableOnly">@android:color/primary_text_light_disable_only</item>
<item name="textColorPrimaryInverseDisableOnly">@android:color/primary_text_dark_disable_only</item>
<item name="textColorPrimaryNoDisable">@android:color/primary_text_light_nodisable</item>
<item name="textColorSecondaryNoDisable">@android:color/secondary_text_light_nodisable</item>
<item name="textColorPrimaryInverseNoDisable">@android:color/primary_text_dark_nodisable</item>
<item name="textColorSecondaryInverseNoDisable">@android:color/secondary_text_dark_nodisable</item>
<item name="textColorHint">@android:color/hint_foreground_light</item>
<item name="textColorHintInverse">@android:color/hint_foreground_dark</item>
<item name="popupWindowStyle">@android:style/widget.popupwindow</item>
<item name="textCheckMark">@android:drawable/indicator_check_mark_light</item>
<item name="textCheckMarkInverse">@android:drawable/indicator_check_mark_dark</item>
<item name="gestureOverlayViewStyle">@android:style/widget.gestureoverlayview.white</item>
<item name="expandableListViewStyle">@android:style/widget.expandablelistview.white</item>
<item name="listViewStyle">@android:style/widget.listview.white</item>
<item name="listDivider">@drawable/divider_horizontal_bright</item>
<item name="listSeparatorTextViewStyle">@android:style/widget.textview.listseparator.white</item>
<item name="progressBarStyle">@android:style/widget.progressbar.inverse</item>
<item name="progressBarStyleSmall">@android:style/widget.progressbar.small.inverse</item>
<item name="progressBarStyleLarge">@android:style/widget.progressbar.large.inverse</item>
<item name="progressBarStyleInverse">@android:style/widget.progressbar</item>
<item name="progressBarStyleSmallInverse">@android:style/widget.progressbar.small</item>
<item name="progressBarStyleLargeInverse">@android:style/widget.progressbar.large</item>
</STYLE>
<!-- Variant of the light theme with no title bar -->
<STYLE name="Theme.Light.NoTitleBar">
<item name="android:windowNoTitle">true</item>
</STYLE>
<!-- Variant of the light theme that has no title bar and fills the entire screen -->
<STYLE name="Theme.Light.NoTitleBar.Fullscreen">
<item name="android:windowFullscreen">true</item>
<item name="android:windowContentOverlay">@null</item>
</STYLE>
<!-- Special variation on the default theme that ensures the background is
completely black. This is useful for things like image viewers and
media players. If you want the normal (dark background) theme
do <em>not use this, use {@link #Theme}. -->
<STYLE name="Theme.Black">
<item name="android:windowBackground">@android:color/black</item>
<item name="android:colorBackground">@android:color/black</item>
</STYLE>
文章来自: 安卓手机网(www.anzhuopp.com) 详文参考:http://www.anzhuopp.com/Androidshouji/1107/