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为能够修改的属性,包括是否要标题栏、字体、字体颜色等;

 

posted @ 2013-01-30 11:39  Fredric_2013  阅读(193)  评论(0编辑  收藏  举报