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. 缩进, Tab 还是空格?(转)

    圣战 圣战个毛线 Android 好还是 iOS 好,Windows 好还是 Mac 好,编辑器好还是 IDE好,中划线好还是下划线好…写代码这么多年,会遇到很多奇葩的毫无意义的所谓脑残粉的争论 昨天 ...

  2. Megacli查看raid磁盘信息

    准备: 新版本的 MegaCli-1.01.24-0.i386.rpm (下载地址:http://www.lsi.com/downloads/Public/MegaRAID%20Common%20Fi ...

  3. Android中的Handler机制

    直接在UI线程中开启子线程来更新TextView显示的内容,运行程序我们会发现,如下错 误:android.view.ViewRoot$CalledFromWrongThreadException: ...

  4. Java基础之读文件——使用输入流读取二进制文件(StreamInputFromFile)

    控制台程序,读取Java基础之读文件部分(StreamOutputToFile)写入的50个fibonacci数字. import java.nio.file.*; import java.nio.* ...

  5. MVC 学习系列

    总是很难说清MVC的概念,即使读了源代码后(读的时候有些东西,理解起来还是有点吃力),也依然能难对整体的每一个具体的原理说的一清二楚.为了达到自己学习的目的,我把自己的学习路线写成文章,一边自己能对M ...

  6. Hibernate Annotation笔记

    (1)简介:在过去几年里,Hibernate不断发展,几乎成为Java数据库持久性的事实标准.它非常强大.灵活,而且具备了优异的性能.在本文中,我们将了解如何使用Java 5 注释来简化Hiberna ...

  7. C++Builder加载Png图片

    有两种方法,一是把该对象的Transparent 的属性设为true,图片的白色代表即为父界面的颜色 而是在头文件加上#include <pngimage.hpp> Image1-> ...

  8. [转]JAVA程序员一定知道的优秀第三方库(2016版)

    原文地址:http://blog.csdn.net/zxc123e/article/details/51418163 几乎每个程序员都知道要“避免重复发明轮子”的道理——尽可能使用那些优秀的第三方框架 ...

  9. RelativeLayout相对布局属性

    RelativeLayout用到的一些重要的属性: 第一类:属性值为true或falseandroid:layout_centerHrizontal 水平居中android:layout_center ...

  10. windows namedPipe 命名管道clent and server

    1.client: #include "iostream" #include "windows.h" using namespace std; void mai ...