Android 使用片段在较大屏幕中找不到工具栏

Android 使用片段在较大屏幕中找不到工具栏,android,android-fragments,android-toolbar,Android,Android Fragments,Android Toolbar,每当我的应用程序出现在大屏幕上时,我都会遇到问题。我正在使用fragment,每当我在较小的屏幕(5.2英寸)上运行应用程序时,工具栏就会显示出来,我可以使用导航栏。但当我在更大的屏幕(5.5英寸)上运行它时,突然整个屏幕都找不到工具栏了 小屏幕: 大屏幕 应用程序\u栏\u抽屉的布局文件: <?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.CoordinatorLayout xmln

每当我的应用程序出现在大屏幕上时,我都会遇到问题。我正在使用fragment,每当我在较小的屏幕(5.2英寸)上运行应用程序时,工具栏就会显示出来,我可以使用导航栏。但当我在更大的屏幕(5.5英寸)上运行它时,突然整个屏幕都找不到工具栏了

小屏幕:

大屏幕

应用程序\u栏\u抽屉的布局文件:

<?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.example.jjcadiz.omas.Drawer">

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

    <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_drawer" />

<android.support.design.widget.FloatingActionButton
    android:id="@+id/fab"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="bottom|end"
    android:layout_margin="@dimen/fab_margin"
    app:srcCompat="@android:drawable/ic_dialog_email" />



在布局中使用此xml将起作用。

将布局xml文件放在此处。布局中的工具栏在哪里?该布局文件仅用于该片段。如果您要求的是导航栏,它包含一个工具栏。因为我可以在更小的屏幕上运行,而不是在更大的屏幕上screen@JJCADIZ请提供包含工具栏和片段容器的实体(活动?)的布局。。。不同的屏幕尺寸有不同的布局吗?@RafałZawadzki看到我的编辑。谢谢
<android.support.v4.widget.DrawerLayout
    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:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true">
    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">
        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:minHeight="?attr/actionBarSize"
            android:background="?attr/colorPrimary"
            app:theme="@style/MyMaterialTheme"
            >
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="50dp"
                android:text="Purchase Order"
                />
        </android.support.v7.widget.Toolbar>
        <FrameLayout
            android:id="@+id/frame_container"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_below="@+id/toolbar">
            <LinearLayout 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:orientation="vertical"
                android:layout_height="match_parent"
                tools:context=".MainActivity"
                android:weightSum="1"
                android:background="@color/BG_beige">


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

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

                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:orientation="vertical"
                        android:paddingBottom="5dp">

                        <TextView
                            android:id="@+id/textView3"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_weight="1"
                            android:text="Purchase Order"
                            android:textColor="@color/omas_blue"
                            android:layout_gravity="center"
                            android:textSize="25sp"
                            android:gravity="center"/>

                        <LinearLayout
                            android:layout_width="match_parent"
                            android:layout_height="41dp"
                            android:orientation="horizontal">

                            <TextView
                                android:id="@+id/textView5"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_weight="1"
                                android:text="Supplier Name:" />

                            <Spinner
                                android:id="@+id/SupplierSpinner"
                                android:layout_width="222dp"
                                android:layout_height="wrap_content" />

                        </LinearLayout>

                        <LinearLayout
                            android:layout_width="match_parent"
                            android:layout_height="match_parent"
                            android:layout_weight="1"
                            android:orientation="horizontal">

                            <TextView
                                android:id="@+id/textView6"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_weight="1"
                                android:text="Date of Transac" />

                            <TextView
                                android:id="@+id/textView4"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_weight="1.61"
                                android:text="TextView" />
                        </LinearLayout>

                        <LinearLayout
                            android:layout_width="match_parent"
                            android:layout_height="55dp"
                            android:orientation="horizontal"
                            android:paddingTop="10dp">

                            <TextView
                                android:id="@+id/textView9"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_weight="1"
                                android:text="Item name"
                                android:gravity="center"
                                android:layout_gravity="center"/>

                            <TextView
                                android:id="@+id/textView8"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_weight="1"
                                android:text="Quantity"
                                android:gravity="center"
                                android:layout_gravity="center"/>

                            <TextView
                                android:id="@+id/textView7"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_weight="1"
                                android:text="Unit Price"
                                android:gravity="center"
                                android:layout_gravity="center"/>
                        </LinearLayout>

                        <LinearLayout
                            android:layout_width="match_parent"
                            android:layout_height="266dp"
                            android:orientation="horizontal">

                            <EditText
                                android:id="@+id/edtName"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_weight="1"
                                android:ems="10"
                                android:inputType="textPersonName"
                                android:hint="Unit Name"/>

                            <EditText
                                android:id="@+id/edtQuantity"
                                android:layout_width="117dp"
                                android:layout_height="wrap_content"
                                android:ems="10"
                                android:inputType="number"
                                android:hint="Quantity" />

                            <EditText
                                android:id="@+id/edtPrice"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_weight="1"
                                android:ems="10"
                                android:inputType="numberDecimal"
                                android:hint="Price"/>
                        </LinearLayout>

                        <LinearLayout
                            android:layout_width="match_parent"
                            android:layout_height="39dp"
                            android:orientation="horizontal">

                            <TextView
                                android:id="@+id/textView11"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_weight="1.99"
                                android:text="Total" />

                            <TextView
                                android:id="@+id/tvTotal"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_weight="1"
                                android:text="PPP" />
                        </LinearLayout>

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

                            <TextView
                                android:id="@+id/textView13"
                                android:layout_width="match_parent"
                                android:layout_height="wrap_content"
                                android:text="Prepared By:" />

                            <TextView
                                android:id="@+id/tvName"
                                android:layout_width="match_parent"
                                android:layout_height="wrap_content"
                                android:text="" />
                        </LinearLayout>

                        <LinearLayout
                            android:layout_width="match_parent"
                            android:layout_height="match_parent"
                            android:layout_weight="1"
                            android:orientation="horizontal">

                            <Button
                                android:id="@+id/btnConfirm"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_weight="1"
                                android:text="Confirm" />

                            <Button
                                android:id="@+id/btnReset"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_weight="1"
                                android:text="Reset" />
                        </LinearLayout>

                    </LinearLayout>

                </LinearLayout>
            </ScrollView>
            </LinearLayout>
        </FrameLayout>
    </RelativeLayout>