转载

Android Theme

常用的theme项

<style name="AppTheme" parent="BaseTheme">
    <!--窗体透明-->
    <item name="android:windowIsTranslucent">true</item>
    <!--窗体背景-->
    <item name="android:windowBackground">@android:color/transparent</item>
</style>

<style name="LaunchTheme" parent="Theme.AppCompat.NoActionBar">
    <!--窗体背景,这个背景能在第一时间显示,可以用作启动界面,但此windows不可再使用view-->
    <item name="android:background">@drawable/bg_launch</item>
</style>

<style name="MainTheme" parent="BaseTheme">
    <!--窗体动画-->
    <item name="android:windowAnimationStyle">@android:style/Animation.Translucent</item>
</style>

<!-- 应用的主要色调,actionBar默认使用该颜色,Toolbar导航栏的底色 -->
<item name="colorPrimary">@color/white</item>
<!-- 应用的主要暗色调,statusBarColor 默认使用该颜色 -->
<item name="colorPrimaryDark">@color/white</item>
<!-- 一般控件的选中效果默认采用该颜色,如 CheckBox,RadioButton,SwitchCompat,ProcessBar等-->
<item name="colorAccent">@color/colorAccent</item>

<!-- 状态栏、顶部导航栏 相关-->
<!-- status bar color -->
<item name="android:statusBarColor">#00000000</item>
<!-- activity 是否能在status bar 底部绘制 -->
<item name="android:windowOverscan">true</item>
<!-- 让status bar透明,相当于statusBarColor=transparent + windowOverscan=true -->
<item name="android:windowTranslucentStatus">true</item>
<!-- 改变status bar 文字颜色, true黑色, false白色,API23可用-->
<item name="android:windowLightStatusBar">true</item>
<!-- 全屏显示,隐藏状态栏、导航栏、底部导航栏 -->
<item name="android:windowFullscreen">true</item>
<!-- hide title bar -->
<item name="windowNoTitle">true</item>
<!-- 底部虚拟导航栏颜色 -->
<item name="android:navigationBarColor">#E91E63</item>
<!-- 让底部导航栏变半透明灰色,覆盖在Activity之上(默认false,activity会居于底部导航栏顶部),如果设为true,navigationBarColor 失效 -->
<item name="android:windowTranslucentNavigation">true</item>

<!-- WindowBackground,可以设置@drawable,颜色引用(@color),不能设置颜色值(#fffffff),
Window区域说明:Window涵盖整个屏幕显示区域,包括StatusBar的区域。当windowOverscan=false时,window的区域比Activity多出StatusBar,当windowOverscan=true时,window区域与Activity相同-->
<item name="android:windowBackground">@drawable/ic_launcher_background</item>

<!-- 控件相关 -->
<!-- button 文字是否全部大写(系统默认开)-->
<item name="android:textAllCaps">false</item>

<!-- 默认 Button,TextView的文字颜色 -->
<item name="android:textColor">#B0C4DE</item>
<!-- 默认 EditView 输入框字体的颜色 -->
<item name="android:editTextColor">#E6E6FA</item>
<!-- RadioButton checkbox等控件的文字 -->
<item name="android:textColorPrimaryDisableOnly">#1C71A9</item>
<!-- 应用的主要文字颜色,actionBar的标题文字默认使用该颜色 -->
<item name="android:textColorPrimary">#FFFFFF</item>
<!-- 辅助的文字颜色,一般比textColorPrimary的颜色弱一点,用于一些弱化的表示 -->
<item name="android:textColorSecondary">#C1C1C1</item>
<!-- 控件选中时的颜色,默认使用colorAccent -->
<item name="android:colorControlActivated">#FF7F50</item>
<!-- 控件按压时的色调-->
<item name="android:colorControlHighlight">#FF00FF</item>
<!-- CheckBox,RadioButton,SwitchCompat等默认状态的颜色 -->
<item name="android:colorControlNormal">#FFD700</item>
<!-- 默认按钮的背景颜色 -->
<item name="android:colorButtonNormal">#1C71A9</item>

<!-- 【无效】 在theme中设置Activity的属性无效, 请到AndroidManifest中Activity标签下设置 -->
<item name="android:launchMode">singleTop</item>
<item name="android:screenOrientation">landscape</item>

所有theme项

<item name="windowActionBar">true</item>
<item name="windowActionBarOverlay">false</item>

<!-- Used by MediaRouter -->
<item name="isLightTheme">false</item>

<item name="selectableItemBackground">@drawable/abc_item_background_holo_dark</item>
<item name="selectableItemBackgroundBorderless">?attr/selectableItemBackground</item>
<item name="homeAsUpIndicator">@drawable/abc_ic_ab_back_mtrl_am_alpha</item>

<item name="dividerVertical">@drawable/abc_list_divider_mtrl_alpha</item>
<item name="dividerHorizontal">@drawable/abc_list_divider_mtrl_alpha</item>

<!-- Action Bar Styles -->
<item name="actionBarTabStyle">@style/Widget.AppCompat.ActionBar.TabView</item>
<item name="actionBarTabBarStyle">@style/Widget.AppCompat.ActionBar.TabBar</item>
<item name="actionBarTabTextStyle">@style/Widget.AppCompat.ActionBar.TabText</item>
<item name="actionButtonStyle">@style/Widget.AppCompat.ActionButton</item>
<item name="actionOverflowButtonStyle">@style/Widget.AppCompat.ActionButton.Overflow</item>
<item name="actionOverflowMenuStyle">@style/Widget.AppCompat.PopupMenu.Overflow</item>
<item name="actionBarStyle">@style/Widget.AppCompat.ActionBar.Solid</item>
<item name="actionBarSplitStyle">?attr/actionBarStyle</item>
<item name="actionBarWidgetTheme">@null</item>
<item name="actionBarTheme">@style/ThemeOverlay.AppCompat.ActionBar</item>
<item name="actionBarSize">@dimen/abc_action_bar_default_height_material</item>
<item name="actionBarDivider">?attr/dividerVertical</item>
<item name="actionBarItemBackground">?attr/selectableItemBackgroundBorderless</item>
<item name="actionMenuTextAppearance">@style/TextAppearance.AppCompat.Widget.ActionBar.Menu</item>
<item name="actionMenuTextColor">?android:attr/textColorPrimaryDisableOnly</item>

<!-- Dropdown Spinner Attributes -->
<item name="actionDropDownStyle">@style/Widget.AppCompat.Spinner.DropDown.ActionBar</item>

<!-- Action Mode -->
<item name="actionModeStyle">@style/Widget.AppCompat.ActionMode</item>
<item name="actionModeBackground">@drawable/abc_cab_background_top_material</item>
<item name="actionModeSplitBackground">?attr/colorPrimaryDark</item>
<item name="actionModeCloseDrawable">@drawable/abc_ic_ab_back_mtrl_am_alpha</item>
<item name="actionModeCloseButtonStyle">@style/Widget.AppCompat.ActionButton.CloseMode</item>

<item name="actionModeCutDrawable">@drawable/abc_ic_menu_cut_mtrl_alpha</item>
<item name="actionModeCopyDrawable">@drawable/abc_ic_menu_copy_mtrl_am_alpha</item>
<item name="actionModePasteDrawable">@drawable/abc_ic_menu_paste_mtrl_am_alpha</item>
<item name="actionModeSelectAllDrawable">@drawable/abc_ic_menu_selectall_mtrl_alpha</item>
<item name="actionModeShareDrawable">@drawable/abc_ic_menu_share_mtrl_alpha</item>

<!-- Panel attributes -->
<item name="panelMenuListWidth">@dimen/abc_panel_menu_list_width</item>
<item name="panelMenuListTheme">@style/Theme.AppCompat.CompactMenu</item>
<item name="panelBackground">@drawable/abc_menu_hardkey_panel_mtrl_mult</item>
<item name="android:panelBackground">@android:color/transparent</item>
<item name="listChoiceBackgroundIndicator">@drawable/abc_list_selector_holo_dark</item>

<!-- List attributes -->
<item name="textAppearanceListItem">@style/TextAppearance.AppCompat.Subhead</item>
<item name="textAppearanceListItemSmall">@style/TextAppearance.AppCompat.Subhead</item>
<item name="listPreferredItemHeight">64dp</item>
<item name="listPreferredItemHeightSmall">48dp</item>
<item name="listPreferredItemHeightLarge">80dp</item>
<item name="listPreferredItemPaddingLeft">16dip</item>
<item name="listPreferredItemPaddingRight">16dip</item>

<!-- Required for use of support_simple_spinner_dropdown_item.xml -->
<item name="spinnerDropDownItemStyle">@style/Widget.AppCompat.DropDownItem.Spinner</item>
<item name="dropdownListPreferredItemHeight">?attr/listPreferredItemHeightSmall</item>

<!-- Popup Menu styles -->
<item name="popupMenuStyle">@style/Widget.AppCompat.PopupMenu</item>
<item name="textAppearanceLargePopupMenu">@style/TextAppearance.AppCompat.Widget.PopupMenu.Large</item>
<item name="textAppearanceSmallPopupMenu">@style/TextAppearance.AppCompat.Widget.PopupMenu.Small</item>
<item name="listPopupWindowStyle">@style/Widget.AppCompat.ListPopupWindow</item>
<item name="dropDownListViewStyle">@style/Widget.AppCompat.ListView.DropDown</item>

<!-- SearchView attributes -->
<item name="searchViewStyle">@style/Widget.AppCompat.SearchView</item>
<item name="android:dropDownItemStyle">@style/Widget.AppCompat.DropDownItem.Spinner</item>
<item name="textColorSearchUrl">@color/abc_search_url_text</item>
<item name="textAppearanceSearchResultTitle">@style/TextAppearance.AppCompat.SearchResult.Title</item>
<item name="textAppearanceSearchResultSubtitle">@style/TextAppearance.AppCompat.SearchResult.Subtitle</item>

<!-- ShareActionProvider attributes -->
<item name="activityChooserViewStyle">@style/Widget.AppCompat.ActivityChooserView</item>

<!-- Toolbar styles -->
<item name="toolbarStyle">@style/Widget.AppCompat.Toolbar</item>
<item name="toolbarNavigationButtonStyle">@style/Widget.AppCompat.Toolbar.Button.Navigation</item>

<item name="android:editTextStyle">@style/Widget.AppCompat.EditText</item>
<item name="editTextBackground">@drawable/abc_edit_text_material</item>
<item name="editTextColor">?android:attr/textColorPrimary</item>
<item name="android:autoCompleteTextViewStyle">@style/Widget.AppCompat.AutoCompleteTextView</item>

<!-- Color palette -->
<item name="colorPrimaryDark">@color/primary_dark_material_dark</item>
<item name="colorPrimary">@color/primary_material_dark</item>
<item name="colorAccent">@color/accent_material_dark</item>

<item name="colorControlNormal">?android:attr/textColorSecondary</item>
<item name="colorControlActivated">?attr/colorAccent</item>
<item name="colorControlHighlight">@color/ripple_material_dark</item>
<item name="colorButtonNormal">@color/button_material_dark</item>
<item name="colorSwitchThumbNormal">@color/switch_thumb_normal_material_dark</item>

<item name="drawerArrowStyle">@style/Widget.AppCompat.DrawerArrowToggle</item>

<item name="switchStyle">@style/Widget.AppCompat.CompoundButton.Switch</item>

<item name="android:ratingBarStyle">@style/Widget.AppCompat.RatingBar</item>

<!-- Button styles -->
<item name="android:buttonStyle">@style/Widget.AppCompat.Button</item>
<item name="android:buttonStyleSmall">@style/Widget.AppCompat.Button.Small</item>
<item name="android:textAppearanceButton">@style/TextAppearance.AppCompat.Button</item>
文章最后发布于: 2019-05-11 23:30:07
展开阅读全文
0 个人打赏
私信求帮助

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 点我我会动 设计师: 上身试试

分享到微信朋友圈

×

扫一扫,手机浏览