展会信息港展会大全

android Theme设置 对每一个Activity设置android:theme
来源:互联网   发布日期:2016-01-14 10:20:28   浏览:2530次  

导读:在AndroidManifest xml文件中,可以对每一个Activity设置android:themetheme的设置 可以设置为系统自带的格式,也可以自定义格式。A: 系统自带格式@android:style Theme Black 背景黑色-有标题-非全屏@andr ...

在AndroidManifest.xml文件中,可以对每一个Activity设置android:theme

theme的设置 可以设置为系统自带的格式,也可以自定义格式。

A: 系统自带格式

@android:style/Theme.Black //背景黑色-有标题-非全屏

@android:style/Theme.Black.NoTitleBar //背景黑色-无标题-非全屏

@android:style/Theme.Black.NoTitleBar.Fullscreen //背景黑色-无标题-全屏显示

@android:style/Theme.Dialog //对话框显示

@android:style/Theme.InputMethod

@android:style/Theme.Light //背景白色-有标题-非全屏

@android:style/Theme.Light.NoTitleBar //背景白色-无标题-非全屏

@android:style/Theme.Light.NoTitleBar.Fullscreen //背景白色-无标题-全屏显示

@android:style/Theme.Light.Panel

@android:style/Theme.Light.WallpaperSettings //背景透明

@android:style/Theme.NoDisplay

@android:style/Theme.Translucent.NoTitleBar.Fullscreen //半透明、无标题栏、全屏

@android:style/Theme.Wallpaper.NoTitleBar.Fullscreen

可以在单个Activity里设置,也可以在applicaiton里全局设置。比如:

B:也可以自定义

1

在activity里加入 android:theme="@style/MyTitleBar" 再在 style.xml里加入

50dip

1

2

<item name="android:windowTitleBackgroundStyle">@style/MyTitleBackground</item>

<item name="android:windowTitleStyle">@style/WindowTitle</item>

@drawable/bg_topbar

true

这里的parent是继承于android:Theme,所以在下面的样式里,只能是window开头的样式才起作用,所有样式请参考 sdkdocsreferenceandroidR.attr.html,

也可以设置windowTitleBackgroundStyle 为@style/MyTitleBackground,这样就可以在MyTitleBackground里,设置背景图啦。

赞助本站

人工智能实验室

相关热词: Theme Activity android

AiLab云推荐
展开

热门栏目HotCates

Copyright © 2010-2024 AiLab Team. 人工智能实验室 版权所有    关于我们 | 联系我们 | 广告服务 | 公司动态 | 免责声明 | 隐私条款 | 工作机会 | 展会港