Android 主题theme说明 摘记
主题Theme就是用来设置界面UI风格,可以设置整个应用或者某个活动Activity的界面风格。在Android SDK中内置了下面的Theme,可以按标题栏Title Bar和状态栏Status Bar是否可见来分类:
- •android:theme="@android:style/Theme.Dialog" 将一个Activity显示为能话框模式
- •android:theme="@android:style/Theme.NoTitleBar" 不显示应用程序标题栏
- •android:theme="@android:style/Theme.NoTitleBar.Fullscreen" 不显示应用程序标题栏,并全屏
- •android:theme="Theme.Light" 背景为白色
- •android:theme="Theme.Light.NoTitleBar" 白色背景并无标题栏
- •android:theme="Theme.Light.NoTitleBar.Fullscreen" 白色背景,无标题栏,全屏
- •android:theme="Theme.Black" 背景黑色
- •android:theme="Theme.Black.NoTitleBar" 黑色背景并无标题栏
- •android:theme="Theme.Black.NoTitleBar.Fullscreen" 黑色背景,无标题栏,全屏
- •android:theme="Theme.Wallpaper" 用系统桌面为应用程序背景
- •android:theme="Theme.Wallpaper.NoTitleBar" 用系统桌面为应用程序背景,且无标题栏
- •android:theme="Theme.Wallpaper.NoTitleBar.Fullscreen" 用系统桌面为应用程序背景,无标题栏,全屏
- •android:theme="Translucent" 半透明
- •android:theme="Theme.Translucent.NoTitleBar" 半透明、无标题栏
- •android:theme="Theme.Translucent.NoTitleBar.Fullscreen" 半透明、无标题栏、全屏
- •android:theme="Theme.Panel"
- •android:theme="Theme.Light.Panel"
这些主题可以应用到整个应用Application范围或者某个活动Activity范围中。
应用Application范围
在AndroidManifest.xml中的application节点中设置theme属性,主题theme应用到整个应用程序中。
<application
android:icon=”@drawable/icon”
Android:icon=”@string/app_name”
Android:icon=”@android:style/ Theme.Black.NoTitleBar”>
活动Activity范围
使用Java代码或者在AndroidManifest.xml中对活动Activity的主题进行设置,主题仅应用到当前活动中。
在AndroidMainifest.xml设置方法:
<activity
android:name=“.About”
android:label=“@string/app_name”
android:theme=“@android:style/ Theme.Black.NoTitleBar” >
使用java代码进行设置,在当前活动Activity的onCreate中进行设置:
@Override
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setTheme(android.R.style.Theme_Translucent_NoTitleBar);
setContentView(R.layout.main);
}
@android:style/Theme.Black //背景黑色-有标题-非全屏
相关文章
- Jitpack发布Android库出现Direct local .aar file dependencies are not supported when building an AAR
- 关于Android12安装apk出现-108异常INSTALL_PARSE_FAILED_MANIFEST_MALFORMED的解决方法
- Android 多module情况下module依赖aar问题处理
- Android7.0以上的分享图片文件错误及解决方法
- Android开发 对接微信分享SDK总结
- Android RecyclerView使用ListAdapter高效刷新数据
- Android自动化测试工具调研
- Android 自动取色并设置沉浸式状态栏
- Java 断点下载(下载续传)服务端及客户端(Android)代码
- Android自定义View学习(1)——基础知识介绍
- Android webview只加载10%且出现白屏问题排查解决
- Android Studio安装插件重启插件消失
- Android Swtich开关样式调整
- Android 实现开机自启APP
- 关于TornadoFx和Android的全局配置工具类封装实现及思路解析
- Android shape与selector标签使用
- Android8.0 后台服务保活的一种思路
- 关于Android安装apk出现解析包异常问题情况总结
- Android 接入腾讯IM即时通信(详细图文)
- Android 语音播放(文字TTS)