在AndroidManifest.xml文件中,可以对每一个Activity设置android:theme

theme的设置 可以设置为系统自带的格式,也可以自定义格式。

A: 系统自带格式

@android:style/Theme.Black//背景黑色-有标题-非全屏

@android:style/Theme.Black.NoTitleBar //背景黑色-无标题-非全屏

@android:style/Theme.Black.NoTitleBar.Fullscreen //背景黑色-无标题-全屏显示

@android:style/Theme.Dialog //对话框显示

@android:style/Theme.InputMethod

@android:style/Theme.Light//背景白色-有标题-非全屏

@android:style/Theme.Light.NoTitleBar //背景白色-无标题-非全屏

@android:style/Theme.Light.NoTitleBar.Fullscreen //背景白色-无标题-全屏显示

@android:style/Theme.Light.Panel

@android:style/Theme.Light.WallpaperSettings //背景透明

@android:style/Theme.NoDisplay

@android:style/Theme.Translucent.NoTitleBar.Fullscreen //半透明、无标题栏、全屏

@android:style/Theme.Wallpaper.NoTitleBar.Fullscreen

可以在单个Activity里设置,也可以在applicaiton里全局设置。比如:

<activity android:screenOrientation="portrait" android:name=".ui.RegisterActivity" android:theme="@android:style/Theme.NoTitleBar"></activity>

B:也可以自定义

在activity里加入 android:theme="@style/MyTitleBar" 再在 style.xml里加入

   <style name="MyTitleBar" parent="android:Theme">         <item name="android:windowTitleSize">50dip</item>         <item name="android:windowTitleBackgroundStyle">@style/MyTitleBackground</item>         <item name="android:windowTitleStyle">@style/WindowTitle</item>   </style>

<!-- 自定义标题栏背景图 -->

<style name="MyTitleBackground" parent="android:TextAppearance.WindowTitle">    <item name="android:background">@drawable/bg_topbar</item>   </style>   <style name="WindowTitle" parent="android:TextAppearance.WindowTitle">    <item name="android:singleLine">true</item>  </style>

这里的parent是继承于android:Theme,所以在下面的样式里,只能是window开头的样式才起作用,所有样式请参考\sdk\docs\reference\android\R.attr.html,

也可以设置windowTitleBackgroundStyle 为@style/MyTitleBackground,这样就可以在MyTitleBackground里,设置背景图啦,

更多相关文章

  1. USB UMS MTP设置过程 (一)
  2. 【EditText】Android(安卓)中设置 EditText 光标颜色
  3. Android(安卓)高通代码预制apk可卸载,恢复出厂设置apk可恢复 Andr
  4. Android(安卓)permission 访问权限大全
  5. android-----EditText
  6. Android使用的MQTT客户端
  7. android:textAppearance设置文字外观
  8. Android权限问题整理
  9. Ubuntu 10.04安装android NDK

随机推荐

  1. Android(安卓)消息处理机制(Looper、Handl
  2. 用Xamarin 实现园友的 :Android浮动小球与
  3. Android(安卓)build system ---转
  4. Android来电铃声默认设置的实现方法与怎
  5. android广告赚钱[转]
  6. Android(安卓)开发者在 Android(安卓)Mar
  7. 博文视点大讲堂37期 ——It's Android(安
  8. 深入浅出 - Android系统移植与平台开发(十
  9. android Handler 机制研究学习笔记
  10. 【译】Google官方推出的Android架构组件