一 、android标题自定义
- 在manifest文件中添加android:theme="@style/infomanage_title"设置标题格式
<pre name="code" class="html"><style name="CustomWindowTitleBackground"> <item name="android:background">#0099ff</item> </style>
在styles中添加以上代码,设置标题的背景色字体大小等格式<style name="infomanage_title" parent="android:Theme"> <item name="android:windowTitleSize">50dp</item> <item name="android:windowTitleBackgroundStyle">@style/CustomWindowTitleBackground</item> </style>
- 在setContentView(R.layout.XXX);之前加代码 requestWindowFeature(Window.FEATURE_CUSTOM_TITLE); // 自定义标题
- 在setContentView(R.layot.XXX);之后加上getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE,R.layout.title_layout); // 为标题设置layout布局
- 在后面可以直接获取控件(和R.layout.XXX获取一样),然后就可以自己随意处理了
1. android设置无标题
在setContentView(R.layout.XXX);之前添加下面代码
// 无标题
requestWindowFeature(Window.FEATURE_NO_TITLE);
2.android设置全屏
在setContentView(R.layout.XXX);之前添加下面代码
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);