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. 让SpringMVC支持可版本管理的Restful接口

    需求 移动互联网时代的到来,软件开发的模式也在变化.记得以前做B/S的后台开发,基本上没有Http接口一说,全部是通过渲染模板技术(jsp,freemark)把最终html展示给最终用户.现在完全变了 ...

  2. 4.Spring Web MVC处理请求的流程

  3. maven 建立ssh项目

    一.新建maven项目,配置ssh框架pom的最低支持 1.新建一个maven项目 依赖于org.springframework/spring-beans/4.1.5.RELEASE 的jar包 Gr ...

  4. compilation filed Unable to write to path xxxxxx 遇到这种情况的话

    如果是xib文件的话 查看target —>Build Phases —> Copy Bundle Resources里面查看路径. 可能有重复路径导致编译不通过.

  5. Lintcode: Interval Sum II

    Given an integer array in the construct method, implement two methods query(start, end) and modify(i ...

  6. Lintcode: Subarray Sum Closest

    Given an integer array, find a subarray with sum closest to zero. Return the indexes of the first nu ...

  7. spark-submit常用参数

    yarn模式默认启动2个executor,无论你有多少的worker节点 standalone模式每个worker一个executor,无法修改executor的数量 partition是RDD中的一 ...

  8. JAVA测试装饰者模式

    package shb.java.demo; /** * 测试装饰者模式 * @package :shb.java.demoJava02 * @author shaobn * @Describe : ...

  9. oracle的函数

    1:nvl函数 nvl函数将一个null值转换为一个实际的值,数据类型可以是日期,数字,字符,数据类型必须匹配,vl能够转换任何数据类型,但是转换的数据类型返回值必须是nvl(expr1,expr2) ...

  10. LDA-math-文本建模

    http://cos.name/2013/03/lda-math-text-modeling/ 4. 文本建模 我们日常生活中总是产生大量的文本,如果每一个文本存储为一篇文档,那每篇文档从人的观察来说 ...