AppCompat v22的windowTranslucentStatus问题 [英] Issue with windowTranslucentStatus with AppCompat v22

查看:170
本文介绍了AppCompat v22的windowTranslucentStatus问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使我的状态栏 透明分别半透明时遇到问题.我正在使用 AppCompat v22 主题.我想将 windowTranslucentStatus 用于API> = 19.我真的在寻找关于stackoverflow的答案,但是找不到针对我问题的任何解决方案. 我认为最简单的方法是向使用该应用程序测试过的智能手机显示我的代码和屏幕截图.

I have an issue with making my Status Bar transparent respectively translucent. I am using AppCompat v22 Theme. I want to use windowTranslucentStatus for API >=19. I really searched for answers on stackoverflow, but i could not find any solution for my problem. I think the easiest way is to show you my code and screenshots from my smartphone I tested the app with.

<RelativeLayout
           android:id="@+id/activitylayout"
           android:fitsSystemWindows="true"
           android:layout_width="fill_parent"
           android:layout_height="fill_parent">

在我的活动"布局的代码上方.

Above the code for my Activity layout.

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">

    <item name="colorPrimary">@color/primary</item>
    <item name="colorPrimaryDark">@color/primary_dark</item>
    <item name="colorAccent">@color/accent</item>
    <item name="drawerArrowStyle">@style/drawerarrowstyle1</item>
    <item name="android:windowTranslucentStatus">true</item>
    <item name="android:fitsSystemWindows">true</item>

我的style.xml(v19)代码. 问题:我的状态栏有白色背景,并且在导航抽屉中甚至看不到.

My style.xml(v19) code. The problem: My Status Bar has a white background and in the nav drawer it is not even visible.

活动布局中状态栏的屏幕截图

导航抽屉中状态栏的屏幕截图

推荐答案

在同一问题中,有三点帮助我.

Three things are help me in the same problem.

  1. 正确的布局文件. Appbar上方的可滚动视图.

  1. Correct layout file. Scrollable View above Appbar.

     <! -- Your Scrollable View -->
    <android.support.v7.widget.RecyclerView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:layout_behavior="@string/appbar_scrolling_view_behavior" />

    <android.support.design.widget.AppBarLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content">
   <android.support.v7.widget.Toolbar
                  ...
                  app:layout_scrollFlags="scroll|enterAlways">

        <android.support.design.widget.TabLayout
                  ...
                  app:layout_scrollFlags="scroll|enterAlways">
     </android.support.design.widget.AppBarLayout>
</android.support.design.widget.CoordinatorLayout>

  • android:fitsSystemWindows="true|false"

    样式定义:

    <style name="AppTheme.TransparentStatusBar">
        <item name="android:windowTranslucentStatus">true</item>
    </style>
    

  • 大概在第2点阐明您的问题.

    exact your problem probably in point 2.

    这篇关于AppCompat v22的windowTranslucentStatus问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆