gpt4 book ai didi

android - 尝试实现 NavigationDrawer 时工具栏重复

转载 作者:行者123 更新时间:2023-11-29 17:37:15 25 4
gpt4 key购买 nike

我正在尝试将抽屉导航与我的相关布局(其中包含我的 Activity 内容)和我的工具栏集成。正如您在下面看到的,工具栏在内部相对布局中被复制,并且存在于它的外部。

突出显示的部分是相对布局。这是我的 XML:

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/landing_page"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@color/frontPageBGColor">

<include
android:id="@+id/app_bar"
layout="@layout/app_bar"
android:layout_height="wrap_content"
android:layout_width="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">


<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">


//Content Content Content

</RelativeLayout>



<fragment
android:id="@+id/fragment_navigation_drawer"
android:layout_height="match_parent"
android:layout_width="280dp"
android:layout_gravity="start"
app:layout="@layout/fragment_navigation_drawer"
android:name="com.xxxxxxxx.chessgame.NavigationDrawerFragment"
tools:layout="@layout/fragment_navigation_drawer" />

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

最佳答案

在你的样式中,你需要继承app theme from .NoTitleBar来移除系统提供的action bar

像这样

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

这里有详细解释:

http://android-developers.blogspot.com/2014/10/appcompat-v21-material-design-for-pre.html

关于android - 尝试实现 NavigationDrawer 时工具栏重复,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30022467/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com