1、先在style中把 statusBarColor 设置为透明  如下

<item name="android:statusBarColor">@android:color/transparent</item>

2、使用material design的页面中,使全屏显示

getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);

3、针对本人自己的情况,我是在toolbar的上面放了一张图片,默认图片会显示在状态栏下面,此时在imageview外套一个framelayout设置

android:fitsSystemWindows为true,图片就会全屏显示,压在状态栏下面。
/此时需要给toolbar设置一个状态栏高度的  margin值,否则,会使toolbar跟状态栏重叠,toolbar中的文字显示不全。因为5.0新特性,当toolbar向上移动时,会默认显示在状态栏的下面
我们做了全屏显示的设置后,toolbar就会跟状态栏重叠。此时可以设置toolbar的margintop为 状态栏高度(6.0为24dp 以下为25dp)
<?xml version="1.0" encoding="utf-8"?>

<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.chuangyuan.qdocument.activity.AboutActivity"> <android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="300dp"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> <android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:contentScrim="?attr/colorPrimary"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<FrameLayout //外面套上framelayout并设置
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true">
<ImageView
android:layout_width="match_parent"
android:layout_height="230dp"
android:src="@drawable/head"
android:scaleType="centerCrop"
app:layout_collapseMode="parallax"
/> </FrameLayout> <android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin"
android:background="@android:color/transparent"
android:layout_marginTop="24dp" //此时需要给toolbar设置一个状态栏高度的 margin值,否则,会使toolbar中的文字显示不全。
/>
</android.support.design.widget.CollapsingToolbarLayout> </android.support.design.widget.AppBarLayout> <android.support.v4.widget.NestedScrollView
android:id="@+id/nested"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"> <LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
> <TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="a。。。代表很多字" /> </LinearLayout>
</android.support.v4.widget.NestedScrollView> </android.support.design.widget.CoordinatorLayout>

android5.x以上 状态栏透明的问题的更多相关文章

  1. Android沉浸式状态栏(透明状态栏)最佳实现

    Android沉浸式状态栏(透明状态栏)最佳实现 在Android4.4之前,我们的应用没法改变手机的状态栏颜色,当我们打开应用时,会出现上图中左侧的画面,在屏幕的顶部有一条黑色的状态栏,和应用的风格 ...

  2. Android状态栏透明(沉浸式效果)

    Android状态栏透明(沉浸式效果) 默认效果 沉浸式效果 方式一 源码 下载地址(Android Studio工程):http://download.csdn.net/detail/q487880 ...

  3. android5.1 隐藏状态栏

    修改frameworks/base/core/res/res/values/dimens.xml文件中 <!-- Height of the status bar --> <!-- ...

  4. android中状态栏透明

    设置 Acitivity 所在 window 的属性 @Override protected void onCreate(Bundle savedInstanceState) { super.onCr ...

  5. apicloud 顶部状态栏透明方法

    api.setStatusBarStyle({ style: 'dark', color:'transparent' });

  6. iOS平台设置系统状态栏(通知栏、顶部状态栏)样式背景颜色或透明

    5+App开发 状态栏 配置系统状态栏样式 iOS平台可支持对系统状态栏样式的配置,在应用manifest.json文件的plus->distribute->apple下添加UIStatu ...

  7. [置顶] Xamarin android沉浸式状态栏

    虽然关于android "沉浸式"状态栏有很多博客介绍过,从小菜到大神无一例外.我第一次看到这种"沉浸"式的效果我也以为真的是这么叫,然而根本不是这么回事,完全 ...

  8. HBuilder设置APP状态栏

    一. 前言 状态栏就是手机屏幕最顶部的区域,包括了:信号.运营商.电量等信息.通常APP都有属于自己的色调风格,为了达到整体视觉美观,通常会设置状态栏和标题栏的色调设置成一致. 图例: 二.状态栏状态 ...

  9. Android修改状态栏颜色全方位教程

    关键字:状态栏着色 透明状态栏 沉浸式 白底黑字 Github Demo:https://github.com/imflyn/Eyes 参考文章: Android-transulcent-status ...

随机推荐

  1. 前端学习——css基础知识,选择器与html模板、值得收藏的html标签

    一.css需要的html(采用html5标准) DTD,文档类型声明: <!Doctype html> 文本编码声明: <meta charset="utf-8" ...

  2. 关于 0xCCCCCCCC

    http://xingyunbaijunwei.blog.163.com/blog/static/76538067201281793111474/ http://stackoverflow.com/q ...

  3. 如何调试DLL组件

    因为DLL组件不像EXE是程序的入口,所以DLL需要其他进程的调用才能调试. 1.首先在DLL项目中你想调试的位置打好断点. 2.如果已经有一个进程,比如foo.exe已经启动,那么就用:调试> ...

  4. linux查看公网地址

    curl cip.cc curl http://members.3322.org/dyndns/getip

  5. PostgreSQL Replication之第十章 配置Slony(5)

    10.5 给复制添加表和管理的问题 一旦我们增加了此表到系统中,我们可以将它添加到复制设置.这样做有点复杂.首先,我们必须创建我们自己的新表集合并把这个和我们已经有的表合并.因此,过一段时间,我们将有 ...

  6. UVa10025-The ? 1 ? 2 ? ... ? n = k problem

    分析:因为数字之间只有加减变换,所以-k和k是一样的,都可以当成整数来考虑,只要找到最小的n满足sum=n*(n+1)/2>=k:且sum和k同奇同偶即可,做法是用二分查找,然后在就近查找 因为 ...

  7. using gulp

    原 荐 gulp构建前端工程 半张一块 发布时间: 2016/07/27 16:22 阅读: 895 收藏: 4 点赞: 4 评论: 2 摘要 Gulp 是一个自动化工具,前端开发者可以使用它来处理常 ...

  8. springday04-go1

    springmvc02:1.创建项目,导入jar包 2.复制xml文件到src下 3.在web.xml中配置DispatcherServlet(代码一致) <?xml version=" ...

  9. String,StringBuffer,StringBuilder三者区别

    String:每次改变,String都会重新构造,内存指针都会改变 StringBuffer:主要用在全局变量中 StringBuilder:在线程内完成字符拼接,因为线程是不安全的,所以完成后可以丢 ...

  10. PAT乙级 1012. 数字分类 (20)

    1012. 数字分类 (20) 时间限制 100 ms 内存限制 65536 kB 代码长度限制 8000 B 判题程序 Standard 作者 CHEN, Yue 给定一系列正整数,请按要求对数字进 ...