在android中,有的时候要做一个无标题的窗口,包括没状态栏的,有两种方法实现:

1 在AndroidManifest.xml配置文件中:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="de.vogella.android.temperature"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".Convert"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-sdk android:minSdkVersion="9" />
</manifest>
就是设置主题为Theme.NoTitleBar.Fullscreen,

或者使用
<application android:icon="@drawable/icon" android:label="@string/app_name" android:theme="@android:style/Theme.NoTitleBar">
2 .Activity代码中可以设置: 有时候不需要去掉整个程序的应用,只想去掉一个的时候就在Activity中

在setContentView()方法的前面插入代码:
requestWindowFeature(Window.FEATURE_NO_TITLE);
即可

。。。。。。。。。。。。。。。。。。。。。。。。。。

getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,

WindowManager.LayoutParams.FLAG_FULLSCREEN);

3. 在res/values目录下面新建一个style.xml的文件

把功能分开的,对于后期的维护好

定义一个styles.xml

<?xmlversion="1.0"encoding="UTF-8"?> <resources> <stylename="concealTitle"> <itemname="android:windowNoTitle">true</item> </style> </resources>

在AndroidManifest.xml中使用了:

<application android:icon="@drawable/icon" android:label="@string/app_name" android:theme="@style/concealTitle">

更多相关文章

  1. Android中Activity全局共享方法AppContext
  2. 查看Android内存的8中方法
  3. Window下android 模拟器SD卡的使用方法
  4. Android虚拟键盘弹出时挡住EditText解决方法
  5. 1、android源代码下载与跟踪
  6. android经典开源代码集合
  7. ReactNative调用原生封装的代码和控件
  8. Android开发人员不得不收集的代码(持续更新中)
  9. Android AM命令行启动程序的方法

随机推荐

  1. Android Tab点击监听 自定义事件
  2. android中实现一个DrawerLayout滑动菜单
  3. Android自定义dialog 单利模式
  4. Android | class | tree
  5. Android ProgressBar 显示在Title上面
  6. Android之SeekBar
  7. Android开发: 调用Camera API 创建Camera
  8. android 设备调试Installation failed wi
  9. Android ExpandableListView详解
  10. Android 闹钟以及通知