Android   发布时间:2022-04-28  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了Android:如何删除工具栏和状态栏之间的界限大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我有兴趣拥有统一的彩色工具栏和状态栏.如果我提供colorPriMary和colorPriMaryDark作为相同的颜色,这应该是可能的.我使用ActionBar获得了所需的结果,但没有使用工具栏.我还将创建一个导航视图,所以我需要状态栏为透明.


代码:Styles-v21

<style name="AppTheme.NoActionBar">
    <item name="windowActionBar">false</item>
    <item name="windowNotitle">true</item>
    <item name="android:windowDrawsSystemBarBACkgrounds">true</item>
    <item name="android:statusBarColor">@android:color/transparent</item>
</style>

代码:样式

<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPriMary">@color/colorPriMary</item>
        <item name="colorPriMaryDark">@color/colorPriMary</item>
        <item name="colOraccent">@color/colOraccent</item>
    </style>

    <style name="AppTheme.NoActionBar">
        <item name="windowActionBar">false</item>
        <item name="windowNotitle">true</item>
    </style>

    <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar"/>

    <style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light"/>

</resources>

重现步骤 :

>使用Navigation Drawer Activity在Android studio中创建一个新项目
>将priMary和priMaryDark设置为相同的颜色
>在设备或模拟器上运行

解决方法

我能想到的唯一@L_607_11@案是从Coordinator Layout中删除android:fitsSystemWindows =“True”

编辑:另一种@L_607_11@案是将协调器布局包装在另一个协调器布局中.

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
    xmlns:android="http://scheR_821_11845@as.android.com/apk/res/android"
    xmlns:app="http://scheR_821_11845@as.android.com/apk/res-auto"
    xmlns:tools="http://scheR_821_11845@as.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true">

    <android.support.design.widget.CoordinatorLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <android.support.design.widget.AppBarLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:theme="@style/AppTheme.AppBarOverlay"
            app:layout_scrollFlags="scroll|enterAlways">

            <android.support.v7.widget.Toolbar
                android:id="@+id/toolbar"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                android:BACkground="?attr/colorPriMary"
                app:popupTheme="@style/AppTheme.PopupOverlay"/>

        </android.support.design.widget.AppBarLayout>


        <include
            layout="@layout/content_main"
            app:layouT_Behavior="@String/appbar_scrolling_view_behavior"/>

    </android.support.design.widget.CoordinatorLayout>
</android.support.design.widget.CoordinatorLayout>

之前


大佬总结

以上是大佬教程为你收集整理的Android:如何删除工具栏和状态栏之间的界限全部内容,希望文章能够帮你解决Android:如何删除工具栏和状态栏之间的界限所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。