Ersetzen Sie veraltetes android.Unterstützung.v4.app.ActionBarDrawerToggle mit Unterstützung.v7 version verursachen Schublade nicht funktioniert auf Jelly Bean
Folgenden die Antwort in diese Frage habe ich ersetzt ActionBarDrawerToggle
der support v4-Bibliothek, die im neuesten update(rev 21) ist veraltet mit den neuesten ActionBarDrawerToggle
von support-v7 library
.
Nun die Schublade funktioniert auf Andrid Lollipop Emulator ohne deprecation-Warnungen, aber wenn ich die app testen, die auf ein Jelly Bean realen Gerät, keine Schublade und kein Umschalten Schublade Schaltfläche angezeigt.
Was zur Hölle appened mit diesem support library aktualisieren? Wie könnte ich dieses Problem lösen ohne den downgrade auf die Vorherige version?
Hier mein layout
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<!-- content view -->
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/drawer_text" />
</RelativeLayout>
<!-- nav drawer -->
<ListView
android:id="@+id/drawer"
android:layout_width="320dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="#F3F3F4"
android:choiceMode="singleChoice"
android:divider="@android:color/transparent"
android:dividerHeight="0dp" />
</android.support.v4.widget.DrawerLayout>
können Sie Ihre layout? neue ActionBarDrawerToggle funktioniert gut für mich
siehe update der Frage
bitte versuchen Sie, die Unterklasse von ActionBarActivity statt FragmentActivity.
Ich habe versucht, um zu ersetzen Sie alle
ja, bitte, schauen Sie sich hier antonioleiva.com/material-design-everywhere und hier chris.Dämonen.mir/2014/10/17/appcompat-v21
siehe update der Frage
bitte versuchen Sie, die Unterklasse von ActionBarActivity statt FragmentActivity.
Ich habe versucht, um zu ersetzen Sie alle
FragmentActivity
mit ActionBarActivity
aber app stürzt ab mit dieser Fehlermeldung You need to use a Theme.AppCompat theme (or descendant) with this activity.
könnten Sie mir mehr details?ja, bitte, schauen Sie sich hier antonioleiva.com/material-design-everywhere und hier chris.Dämonen.mir/2014/10/17/appcompat-v21
InformationsquelleAutor AndreaF | 2014-10-18
Du musst angemeldet sein, um einen Kommentar abzugeben.
ActionBarDrawerToggle
v7, um richtig zu arbeiten, müssen Sie erstreckt Ihre Tätigkeit-Klasse ausandroid.support.v7.app.ActionBarActivity
ActionBarActivity
v7 verwendet werden muss, mitTheme.AppCompat
Thema aus derappcompat-v7:21
support library.ActionBar
zuToolBar
, nicht hinzufügen<item name="windowActionBar">false</item>
bei der ErweiterungTheme.AppCompat
. Dabei wird IhrActionBarActivity
haben keine Standard -ActionBar
- DekorgetSupportActionBar
ist, wird null zurückgegeben. Sie müssen Ihre eigenenToolBar
- und call -setSupportActionBar
ersten machengetSupportActionBar
Arbeit.InformationsquelleAutor mindex