После выполнения инструкции здесь: http://developer.android.com/training/appbar/setting-up.htmlAndroid 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 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>
И вот styles.xml
<resources>
<style name="AppBar" parent="ThemeOverlay.AppCompat.ActionBar"/>
<style name="Popup" parent="ThemeOverlay.AppCompat.Light" />
<style name="GdxTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:colorBackgroundCacheHint">@null</item>
<item name="android:windowAnimationStyle">@android:style/Animation</item>
<item name="android:windowContentOverlay">@null</item>
</style>
</resources>
И вот на что я его инициализации, на классе, который AppCompatActivity:
@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));
}
Итак, кто-нибудь знает, почему панель действий даже не появляется?
Дополнительная информация: фрагмент на дисплее представляет собой фрагмент libGDX.