theme

theme用以定义android系统UI部分的风格,有两种方式设置:

1、在manefest里定义android:theme属性;

2、在activity的onCreate方法中调用:this.setTheme(R.style.NewTheme);

newTheme定义在style.xml中,如下:

<resources>

    <style name="AppBaseTheme" parent="android:Theme.Light">
    </style>

    <style name="AppTheme" parent="AppBaseTheme">
    </style>

    <style name="NewTheme" parent="android:Theme.Dialog">  //对话框风格
        <item name="android:windowNoTitle">true</item>
        <item name="android:textSize">24sp</item>
    </style>

</resources>

其中Theme.Dialog是Andriod自动的主题,包括:

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="Theme.Translucent : 透明背景
  • 透明背景并无标题
  • android:theme="Theme.Translucent.NoTitleBar"
  • 透明背景并无标题,全屏
  • android:theme="Theme.Translucent.NoTitleBar.Fullscreen"
  • 面板风格显示
  • android:theme="Theme.Panel "
  • 平板风格显示
  • android:theme="Theme.Light.Panel"

item为能够修改的属性,包括是否要标题栏、字体、字体颜色等;

时间: 2024-10-12 19:26:26

theme的相关文章

Android的Style和Theme 译文

Style 是Window和View的一种外观和格式的属性集合.它可以作为高度,间距,字体大小,背景颜色等属性.Style是一种 xml 资源文件,放在和布局文件不同的文件夹里: Style 的设计理念和 Web一脉相承--即它们都允许你把内容和样式分离. 例如,你用Style可以把下面这个xml文件: <TextView android:layout_width="fill_parent" android:layout_height="wrap_content&quo

Linux mint cinnamon how to customize theme

Linux mint cinnamon       how to customize theme Linux mint have two style theme- system theme and user theme eg: system setting->themes like picture below: Void is user theme and the other is system theme,system theme can't be uninstalled. So the th

Notepad++ sublime text theme for C/C++

转自:https://coderwall.com/p/36x7uw 嗯,我决定还是把 整个文件贴出来,方便: 导入方法: 找到notepad++的目录,进入到themes里面. 建立一个:Waher-style.xml 然后把下面的内容copy进去.保存重启notepad++.然后在Settings 选择 Style Configurator. 在Select theme:里选择Waher-style. <?xml version="1.0" encoding="Win

Android 5.x Theme 与 ToolBar 实战

1.概述 随着Material Design的逐渐的普及,业内也有很多具有分享精神的伙伴翻译了material design specification ,中文翻译地址:Material Design 中文版.So,我们也开始Android 5.x相关的blog,那么首先了解的当然是其主题的风格以及app bar. 当然,5.x普及可能还需要一段时间,所以我们还是尽可能的去使用兼容包支持低版本的设备. ps:本博客使用: compileSdkVersion 22 buildToolsVersio

poj1743 Musical Theme

地址:http://poj.org/problem?id=1743 题目: Musical Theme Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 28675   Accepted: 9674 Description A musical melody is represented as a sequence of N (1<=N<=20000)notes that are integers in the range

hdu4763 Theme Section

地址:http://acm.hdu.edu.cn/showproblem.php?pid=4763 题目: Theme Section Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3491    Accepted Submission(s): 1623 Problem Description It's time for music!

POJ 1743Musical Theme

Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 27889   Accepted: 9413 Description A musical melody is represented as a sequence of N (1<=N<=20000)notes that are integers in the range 1..88, each representing a key on the piano. It is u

开发中遇到的问题(一)——java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.

1.错误描述: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity. 2.起因: 在Manifest中设置我的activity全屏 1 <activity android:name=".SplashActivity" 2 android:theme="@android:style/Theme.Black.No

POJ1743 Musical Theme [没做出来]

Musical Theme Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 27539   Accepted: 9290 Description A musical melody is represented as a sequence of N (1<=N<=20000)notes that are integers in the range 1..88, each representing a key on the

编译或运行时可能会出现错误: Error:Error retrieving parent for item: No resource found that matches the given name “Theme.AppCompat.Light”

这个问题我在刚开始写"HelloWorld"时就遇到,以为是API版本太高,下载了常用的API 19.17--一系列的,后来还是有问题.就上网查了很多,遇到几篇不错的文章,记录下来,方便以后查看. No resource found that matches the given name 'Theme.AppCompat.Light 的完美解决方案  http://www.360doc.com/content/15/0316/15/9200790_455576135.shtml And