Android操作栏不显示

Android操作栏不显示,android,android-layout,android-fragments,android-actionbar,Android,Android Layout,Android Fragments,Android Actionbar,按照此处的说明进行操作后: appbar仍然没有显示,我们可以在这里看到: 然而,我假设工具栏存在于程序中,因为在程序崩溃的地方我没有得到任何NullPointException。所以我认为这更像是一个样式表问题 下面是活动XML <!-- A DrawerLayout is intended to be used as the top-level content view using match_parent for both width and height to consume

按照此处的说明进行操作后:

appbar仍然没有显示,我们可以在这里看到:

然而,我假设工具栏存在于程序中,因为在程序崩溃的地方我没有得到任何NullPointException。所以我认为这更像是一个样式表问题

下面是活动XML

<!-- A DrawerLayout is intended to be used as the top-level content view using match_parent for both width and height to consume the full space available. -->
<android.support.v4.widget.DrawerLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="pt.bluecover.wearable3d.DrawerActivity">

    <!-- placed here as explained @
    http://developer.android.com/training/appbar/setting-up.html -->
    <android.support.v7.widget.Toolbar
        android:id="@+id/my_toolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:background="?attr/colorPrimary"
        android:elevation="4dp"
        android:theme="@style/AppBar"
        app:popupTheme="@style/Popup"/>

    <!-- As the main content view, the view below consumes the entire
         space available using match_parent in both dimensions. -->
    <FrameLayout
        android:id="@+id/container"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <!-- The drawer is given a fixed width in dp and extends the full height of
         the container. -->
    <fragment
        android:id="@+id/navigation_drawer"
        android:name="pt.bluecover.wearable3d.NavigationDrawerFragment"
        android:layout_width="@dimen/navigation_drawer_width"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        tools:layout="@layout/drawer_drawer" />

</android.support.v4.widget.DrawerLayout>
那么,有人知道为什么动作栏没有出现吗

额外信息:显示的片段是libGDX片段。

“Theme.AppCompat.Light.NoActionBar



也许您应该更改“无操作栏”

您正在将工具栏隐藏在framelayout下。将布局更改为

<android.support.v4.widget.DrawerLayout..>
  <LinearLayout 
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:orientation="vertical">
      <android.support.v7.widget.Toolbar..>
      <FrameLayout ../>
  </LinearLayout>
  <!-- navigation Fragment -->
  <fragment ../>
</android.support.v4.widget.DrawerLayout> 

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_drawer);

    //lets set the toolbar
    Toolbar myToolbar = (Toolbar) findViewById(R.id.my_toolbar);
    setSupportActionBar(myToolbar);

    mNavigationDrawerFragment = (NavigationDrawerFragment)
            getFragmentManager().findFragmentById(R.id.navigation_drawer);
    mTitle = getTitle();

    // Set up the drawer.
    mNavigationDrawerFragment.setUp(
            R.id.navigation_drawer,
            (DrawerLayout) findViewById(R.id.drawer_layout));
}
<style name="GdxTheme" parent="Theme.AppCompat.Light.NoActionBar">
<android.support.v4.widget.DrawerLayout..>
  <LinearLayout 
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:orientation="vertical">
      <android.support.v7.widget.Toolbar..>
      <FrameLayout ../>
  </LinearLayout>
  <!-- navigation Fragment -->
  <fragment ../>
</android.support.v4.widget.DrawerLayout>