摘要 Android平台定义的主题样式: android:theme="@android:style/Theme.Dialog" // 将一个Activity显示为对话框模式android:theme="@android:style/Theme.NoTitleBar" // 不显示应用程序标题栏android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
//

Android平台定义的主题样式:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
 android:theme="@android:style/Theme.Dialog"

// 将一个Activity显示为对话框模式
 android:theme="@android:style/Theme.NoTitleBar"

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

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

// 背景为白色
 android:theme="@android:style/Theme.Light.NoTitleBar"

// 白色背景并无标题栏
 android:theme="@android:style/Theme.Light.NoTitleBar.Fullscreen"

// 白色背景。无标题栏,全屏
 android:theme="@android:style/Theme.Black"

// 背景黑色
 android:theme="@android:style/Theme.Black.NoTitleBar"

// 黑色背景并无标题栏
 android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"

// 黑色背景,无标题栏,全屏
 android:theme="@android:style/Theme.Wallpaper"

// 用系统桌面为应用程序背景
 android:theme="@android:style/Theme.Wallpaper.NoTitleBar"

// 用系统桌面为应用程序背景。且无标题栏
 android:theme="@android:style/Theme.Wallpaper.NoTitleBar.Fullscreen"

// 用系统桌面为应用程序背景,无标题栏,全屏
 android:theme="@android:style/Translucent"

// 半透明效果
 android:theme="@android:style/Theme.Translucent.NoTitleBar"

// 半透明并无标题栏
 android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"

// 半透明效果,无标题栏。全屏

Android平台定义了三种字体大小:

1
2
3
"?android:attr/textAppearanceLarge"
 "?android:attr/textAppearanceMedium"
 "?android:attr/textAppearanceSmall"

Android字体颜色:

1
2
3
4
5
 android:textColor="?android:attr/textColorPrimary"
 android:textColor="?android:attr/textColorSecondary"
 android:textColor="?android:attr/textColorTertiary"
 android:textColor="?

android:attr/textColorPrimaryInverse"

 android:textColor="?

android:attr/textColorSecondaryInverse"

Android的ProgressBar样式:

1
2
3
4
 style="?android:attr/progressBarStyleHorizontal"
 style="?

android:attr/progressBarStyleLarge"

 style="?

android:attr/progressBarStyleSmall"

 style="?android:attr/progressBarStyleSmallTitle"

分隔符



横向:

1
2
3
<View
android:layout_width=
"fill_parent"
android:layout_height="1dip"
android:background="?

android:attr/listDivider"

/>

纵向:

1
2
3
<View
android:layout_width=
"1dip"
android:layout_height="fill_parent"
android:background="?

android:attr/listDivider"

/>

CheckBox样式: 

style="?android:attr/starStyle"

类似标题栏效果的TextView



style="?android:attr/listSeparatorTextViewStyle"

其他实用的样式:

1
2
3
4
5
6
 android:layout_height="?android:attr/listPreferredItemHeight"
 android:paddingRight="?

android:attr/scrollbarSize"

 style="?

android:attr/windowTitleBackgroundStyle"

 style="?android:attr/windowTitleStyle"
 android:layout_height="?

android:attr/windowTitleSize"

 android:background="?

android:attr/windowBackground"

改动Activity的标题栏样式

如在styles.xml中添加:

1
2
3
4
5
6
7
8
9
<resources>
<style
name=
"AutoWindowTitleBackground">
<item
name=
"android:background">#778899</item>
</style>
<style
name=
"autoWindowTitlebar"

parent=
"android:Theme">
<item
name=
"android:windowTitleSize">32dp</item>
 <item
name=
"android:windowTitleBackgroundStyle">@style/AutoWindowTitleBackground</item>
 </style>
</resources>

接着再改动AndroidManifest.xml文件。找到要自己定义标题栏的Activity,加入上android:theme值。比方:

1
2
<activity
android:name=
".MainActivity"
 android:theme="@style/autoWindowTitlebar">

去掉全部Activity界面的标题栏

改动AndroidManifest.xml



在application 标签中加入:

1
android:theme=”@android:style/Theme.NoTitleBar”


Android开发之style属性和提前定义样式的更多相关文章

  1. Android开发之EditText属性详解

    1.EditText输入的文字为密码形式的设置 (1)通过.xml里设置: 把该EditText设为:android:password="true" // 以”.”形式显示文本 ( ...

  2. 【转】 Android开发之EditText属性详解

    原文网址:http://blog.csdn.net/qq435757399/article/details/7947862 1.EditText输入的文字为密码形式的设置 (1)通过.xml里设置: ...

  3. 【Android UI】Android开发之View的几种布局方式及实践

    引言 通过前面两篇: Android 开发之旅:又见Hello World! Android 开发之旅:深入分析布局文件&又是“Hello World!” 我们对Android应用程序运行原理 ...

  4. Android开发之PopupWindow

      /* *  Android开发之PopupWindow * *  Created on: 2011-8-8 *  Author: blueeagle *  Email: liujiaxiang@g ...

  5. Android开发之TextView高级应用

    Android开发之TextView高级应用 我们平时使用TextView往往让它作为一个显示文字的容器,但TextView的功能并不局限于此.以下就和大家分享一下TextView的一些使用技巧. A ...

  6. Android开发之InstanceState详解

    Android开发之InstanceState详解   本文介绍Android中关于Activity的两个神秘方法:onSaveInstanceState() 和 onRestoreInstanceS ...

  7. Android开发之旅: Intents和Intent Filters(理论部分)

    引言 大部分移动设备平台上的应用程序都运行在他们自己的沙盒中.他们彼此之间互相隔离,并且严格限制应用程序与硬件和原始组件之间的交互. 我们知道交流是多么的重要,作为一个孤岛没有交流的东西,一定毫无意义 ...

  8. Android 开发之旅:深入分析布局文件&又是“Hello World!”

    http://www.cnblogs.com/skynet/archive/2010/05/20/1740277.html 引言 上篇可以说是一个分水岭,它标志着我们从Android应用程序理论进入实 ...

  9. Android开发之InstanceState详解(转)---利用其保存Activity状态

    Android开发之InstanceState详解   本文介绍Android中关于Activity的两个神秘方法:onSaveInstanceState() 和 onRestoreInstanceS ...

随机推荐

  1. admin嵌套在spring mvc项目里,菜单栏点击新连接每次都会重置

    <ul class="treeview-menu" id="ul_schedule"> <li><a href="#&q ...

  2. zookeeer 集群和伪集群模式

    环境变量设置: # .bash_profile # Get the aliases and functions if [ -f ~/.bashrc ]; then . ~/.bashrc fi # U ...

  3. POJ 2455 网络流 基础题 二分+网络流 dicnic 以及 sap算法

    Secret Milking Machine Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 8189   Accepted: ...

  4. SQLServer分页查询存储过程

    项目中用到的SQLServer分页查询存储过程. [存储过程] create PROCEDURE prcPageResult -- 获得某一页的数据 -- @currPage int = 1,     ...

  5. BZOJ 1592: [Usaco2008 Feb]Making the Grade 路面修整( dp )

    最优的做法最后路面的高度一定是原来某一路面的高度. dp(x, t) = min{ dp(x - 1, k) } + | H[x] - h(t) | ( 1 <= k <= t ) 表示前 ...

  6. cocos2d-x游戏开发系列教程-坦克大战游戏之虚拟手柄控制坦克移动

    上篇显示了控制手柄,但是还不能用来控制坦克, 这篇将会讲手柄和坦克的移动结合起来. 1.先在CityScene场景中实现场景的虚函数virtual void onEnter(); onEnter在进入 ...

  7. 基于visual Studio2013解决面试题之1102合并字符串

     题目

  8. Cppcheck 1.54 C/C++静态代码分析工具

    Cppcheck是一个C/C++代码分析工具,只检测那些编译器通常无法检测到的bug类型.   官方上建议让编译器提供尽量多的警告提示:1.使用Visual C++的话,应使用警告等级4 2.使用GC ...

  9. 通过 Spring RestTemplate 调用带请求体的 Delete 方法(Delete With Request Body)

    Spring 框架的RestTemplate 类定义了一些我们在通过 java 代码调用 Rest 服务时经常需要用到的方法,使得我们通过 java 调用 rest 服务时更加方便.简单.但是 Res ...

  10. Eclipse用法和技巧三:自动生成Main方法2

    上一篇文章里面介绍了新建文件时候自动添加main方法,这里接着介绍自动联想main方法.       步骤一:输入"main” 步骤二:保持光标在上图位置,按ALT + /,再回车 上一篇文 ...