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 //背景黑色-有标题-非全屏
相关文章
- [PHP] laravel框架注意bootstrap/cache
- [日常] 小白来装机基本概念BIOS与硬盘分区
- [小程序]微信小程序获取位置展示地图并标注信息
- [小程序]微信小程序获取input并发送网络请求
- [小程序]微信小程序登陆并获取用户信息
- [小程序] 支付宝小程序使用list时提示元素不存在
- Android平台GB28181设备接入端PTZ指令对接详解
- [javascript] 支付宝小程序网络GET请求
- [android] 与PHP的session进行交互demo
- [android] post请求接口demo测试代码
- [android] 练习使用ListView(三)
- [android] 练习使用ListView(二)
- [android] 练习使用ListView(一)
- [android] 练习viewpagerindicator的使用(二)
- [日常] 小白来装机基本概念BIOS与硬盘分区
- [android] 两种异步方式
- [android] 通过比对进行容器联动
- [android] 实现返回键操作思路
- [android] 标题部分管理
- [android] socket在手机上的应用