android app去除标题栏

<span style="font-size:12px;">配置文件中直接修改</span>
<span style="font-size:12px;">代码里修改</span>
<span style="font-size:12px;">style.xml中修改</span>
<pre name="code" class="html"><span style="font-size:14px;">  1.AndroidManifest.xml中修改</span>
<span style="font-size:14px;">               修改activity的theme</span>
 
 <activity
            android:name="com.example.newtest.MainActivity"
            android:screenOrientation="landscape"
            android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
            android:label="@string/app_name" >
        </activity>

android:theme="Theme.NoTitleBar"     去除标题栏

android:theme="Theme.NoTitleBar.Fullscreen"   去除标题栏加时间栏及下拉框

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

android:theme="Theme.Light.NoTitleBar.Fullscreen" 白色背景,无标题栏,全屏  

android:theme="Theme.Translucent.NoTitleBar"  透明背景并无标题 

android:theme="Theme.Translucent.NoTitleBar.Fullscreen"  透明背景并无标题,全屏

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

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

android:theme="Theme.Wallpaper.NoTitleBar.Fullscreen" 用系统桌面为应用程序背景,无标题栏,全屏 

   2.Activity中修改

 protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
//        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,  WindowManager.LayoutParams.FLAG_FULLSCREEN); 
        // 实现无标题栏(但有系统自带的任务栏): 
         requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.activity_main);
         
    }
     在activity的onCreate方法的 setContentView(R.layout.activity_main);前加

       getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,  WindowManager.LayoutParams.FLAG_FULLSCREEN); //去除系统的时间栏和下拉框

       requestWindowFeature(Window.FEATURE_NO_TITLE); // 去除app的标题栏

  3.style.xml中修改

 <style name="AppTheme" parent="AppBaseTheme">
        <!-- All customizations that are NOT specific to a particular API-level can go here. -->
         <!-- 隐藏状态栏 -->
    <item name="android:windowFullscreen">true</item>
    <!-- 隐藏标题栏 -->
    <item name="android:windowNoTitle">true</item>
    </style>






                
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值