Android 系统状态栏一体化

 

转载地址:http://www.apkbus.com/archiver/tid-236727.html

 

Android4.4新特性,系统状态栏一体化。实现的步骤主要有以下几点:1.android4.4 以上版本2.设置app全屏:方法:在AndroidManifest.xml中设置android:theme="@android:style/Theme.Translucent.NoTitleBar"3.加载nineoldandroids-2.4.0.jar4.实现类:把状态栏背景设为全透明。项目结构图如下:主要调用的方法在MainActivity.java中实现如下:package com.ycf.systemstatus;

import com.example.exerbar.R;

import android.app.Activity;
import android.os.Build;
import android.os.Bundle;
import android.view.Window;
import android.view.WindowManager;

public class MainActivity extends Activity
{
      @Override
      protected void onCreate(Bundle savedInstanceState)
      {
                super.onCreate(savedInstanceState);
                setTranslucentStatus();
                setContentView(R.layout.activity_main);
      }
      
      /**
         * 设置状态栏背景状态
         */
      private void setTranslucentStatus()
      {
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT)
                {
                        Window win = getWindow();
                        WindowManager.LayoutParams winParams = win.getAttributes();
                        final int bits = WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS;
                        winParams.flags |= bits;
                        win.setAttributes(winParams);
                }
                SystemStatusManager tintManager = new SystemStatusManager(this);
                tintManager.setStatusBarTintEnabled(true);
                tintManager.setStatusBarTintResource(0);//状态栏无背景
      }
}

有这方面需求的朋友可以下载试试。 资源地址:http://download.csdn.net/detail/aiyuan0204/8485597 注:这是android4.4新特性,只支持4.4以上版本下面是效果图:

 

附录:

android:theme="@android:style/Theme.Dialog" : Activity显示为对话框模式

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

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

android:theme="Theme.Light ": 背景为白色

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

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

android:theme="Theme.Black" : 背景黑色

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

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

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

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

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

android:theme="Theme.Translucent : 透明背景

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

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

android:theme="Theme.Panel ": 面板风格显示

android:theme="Theme.Light.Panel" : 平板风格显示


 

  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值