欢迎访问 生活随笔!

生活随笔

当前位置: 首页 > 运维知识 > Android >内容正文

Android

Android 系统自带 Theme(主题)

发布时间:2025/3/14 Android 65 豆豆
生活随笔 收集整理的这篇文章主要介绍了 Android 系统自带 Theme(主题) 小编觉得挺不错的,现在分享给大家,帮大家做个参考.

 系统为我们提供了丰富的系统自带的Theme,当然,你也可以自定义Theme,前提是该Theme必须继承与某个已经存在地Theme,否则编译器会提示错误的。

1、 应用Theme属性两种方式

      ①、在AndroidManifest.xml文件中在<application/>或者<activity />节点设置android:theme属性.

      ②、直接在代码中调用方法setTheme()设置该Activity的主题,必须得在第一次调用setContentView()前设置。

 

常用的系统定义的Theme如下:

 

默认:

 

(1):android:theme="@android:style/Theme.Dialog" 将一个Activity显示为能话框模式 


(2):android:theme="@android:style/Theme.NoTitleBar" 不显示应用程序标题栏 


(3):android:theme="@android:style/Theme.NoTitleBar.Fullscreen" 不显示应用程序标题栏,并全屏 


(4):android:theme="Theme.Light" 背景为白色 


(5):android:theme="Theme.Light.NoTitleBar" 白色背景并无标题栏 


(6):android:theme="Theme.Light.NoTitleBar.Fullscreen" 白色背景,无标题栏,全屏 


(7):android:theme="Theme.Black" 背景黑色 


(8):android:theme="Theme.Black.NoTitleBar" 黑色背景并无标题栏 


(9):android:theme="Theme.Black.NoTitleBar.Fullscreen" 黑色背景,无标题栏,全屏 

 


(10):android:theme="Theme.Wallpaper" 用系统桌面为应用程序背景

 

 
(11):android:theme="Theme.Wallpaper.NoTitleBar" 用系统桌面为应用程序背景,且无标题栏 

 


(12):android:theme="Theme.Wallpaper.NoTitleBar.Fullscreen" 用系统桌面为应用程序背景,无标题栏,全屏 


(13):android:theme="Translucent"  透明背景


(14):android:theme="Theme.Translucent.NoTitleBar"  透明背景并无标题


(15):android:theme="Theme.Translucent.NoTitleBar.Fullscreen"  透明背景并无标题,全屏

 


(16):android:theme="Theme.Panel"   面板风格显示


(17):android:theme="Theme.Light.Panel" 平板风格显示

 

参考地址:

http://blog.csdn.net/xiaodongvtion/article/details/7873001

http://blog.chinaunix.net/uid-24448954-id-2846673.html

转载于:https://www.cnblogs.com/ywtk/p/4135237.html

总结

以上是生活随笔为你收集整理的Android 系统自带 Theme(主题)的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。