Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/195.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 带有菜单图标和标题的透明工具栏不工作_Android_Android Actionbar_Navigation Drawer - Fatal编程技术网

Android 带有菜单图标和标题的透明工具栏不工作

Android 带有菜单图标和标题的透明工具栏不工作,android,android-actionbar,navigation-drawer,Android,Android Actionbar,Navigation Drawer,我的标题栏如下所示: 我试图使其透明,以便仅将导航图标和地图全屏显示在地图视图中,但每次我尝试使用透明代码使条形图透明时,结果显示为白色 我也尝试了edNoActionbar,但最终还是显示了一个白色的标题栏 Home\u activity.xml <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-

我的标题栏如下所示:

我试图使其透明,以便仅将导航图标和地图全屏显示在地图视图中,但每次我尝试使用透明代码使条形图透明时,结果显示为白色

我也尝试了ed
NoAction
bar,但最终还是显示了一个白色的标题栏

Home\u activity.xml

<RelativeLayout 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"
android:background="@android:color/transparent"
android:scrollbars="horizontal">

<RelativeLayout
    android:id="@+id/main"
    android:layout_width="match_parent"
    android:layout_height="match_parent">


    <android.support.v4.widget.DrawerLayout xmlns:app="http://schemas.android.com/apk/res-auto"
        android:id="@+id/drawer_layout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@android:color/transparent"
        tools:openDrawer="start">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">

            <android.support.v7.widget.Toolbar
                android:id="@+id/toolbar"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                android:layout_gravity="center"
                android:background="@android:color/transparent"
                android:fitsSystemWindows="true"
                app:popupTheme="@style/Theme.AppCompat.NoActionBar">

            </android.support.v7.widget.Toolbar>
            <!-- The first child in the layout is for the main Activity UI-->
            <FrameLayout
                android:id="@+id/frame"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_alignTop="@+id/drawer_layout"

                android:scrollbars="horizontal"
                app:layout_behavior="@string/appbar_scrolling_view_behavior">

                <ImageView
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                />

            </FrameLayout>
        </LinearLayout>

        <!-- Side navigation drawer UI -->

        <android.support.design.widget.NavigationView
            android:id="@+id/nav_view"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_gravity="start"
            app:headerLayout="@layout/navigation_header"
            app:itemBackground="@drawable/naviagtionview_statecolor"
            app:itemIconTint="@color/black"
            app:itemTextColor="@color/black"
            app:menu="@menu/my_navigation_items">

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


    </android.support.v4.widget.DrawerLayout>
</RelativeLayout>

我也有类似的问题,
我用了不同的方法来实现它,

您可以尝试使工具栏透明。

此链接可能确实有用并回答问题,但如果它消失,则此答案将不再有用,请评论此链接或确保在此处包含答案的重要部分,所以它本身就很有用。我试着给它加上假-真-真,但结果仍然显示标题栏上的白色背景
<resources xmlns:tools="http://schemas.android.com/tools">

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/hint</item>
    <item name="drawerArrowStyle">@style/MyDrawerArrowToggle</item>
    <item name="colorPrimaryDark">@color/hint</item>
    <item name="colorAccent">@color/black</item>
    <item name="actionBarStyle">@style/MyTheme.ActionBar.TitleTextStyle</item>




</style>
<style name="MyTheme.ActionBar" parent="android:Widget.Holo.ActionBar">
    <item name="android:background">@android:color/transparent</item>
    <item name="android:backgroundStacked">@android:color/transparent</item>
    <item name="android:displayOptions">showTitle</item>
    <item name="android:titleTextStyle">@style/MyTheme.ActionBar.TitleTextStyle</item>
</style>
<style name="AppTheme.NoActionBar" parent="Theme.AppCompat.Light.NoActionBar">
    <!-- Customize your theme here. -->
    <item name="drawerArrowStyle">@style/MyDrawerArrowToggle</item>



</style>

<style name="MyTheme.ActionBar.TitleTextStyle" parent="@android:style/TextAppearance">
    <item name="android:textColor">@color/black</item>

</style>

<style name="MyDrawerArrowToggle" parent="Widget.AppCompat.DrawerArrowToggle">
    <item name="color">@color/black</item>

</style>

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



<style name="EditText.Login" parent="Widget.AppCompat.EditText">
    <item name="android:textColor">@android:color/black</item>
    <item name="android:textColorHint">@android:color/darker_gray</item>
    <item name="colorAccent">@color/yellow</item>
    <item name="colorControlNormal">@color/black</item>
    <item name="colorControlActivated">@color/yellow</item>
</style>