Ich füge die neue Materialdesign-Aktionsleiste aus der neuen appcompat hinzu und verwende das neue Werkzeugleisten-Widget. Ich habe einen benutzerdefinierten Hintergrund auf der Symbolleiste auf XML gesetzt, aber mein Problem ist, dass der Schlagschatten von der Aktionsleiste nicht angezeigt wird. Weißt du wie das geht?Android: Appcompat 21 Hinzufügen von Schatten auf der Aktionsleiste
Toolbar Code
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/my_awesome_toolbar"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:minHeight="?attr/actionBarSize"
android:background="@drawable/ab_background_textured"
app:theme="@style/MyTheme"
app:popupTheme="@style/MyTheme.Popup"/>
MyTheme Stil
<style name="MyTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="android:textColorPrimary">@color/abc_primary_text_material_dark</item>
<item name="actionMenuTextColor">@color/abc_primary_text_material_dark</item>
<item name="android:textColorSecondary">#ffff8800</item>
</style>
MyTheme.Popup Stil
<style name="MyTheme.Popup" parent="ThemeOverlay.AppCompat.Dark">
<item name="android:textColor">#ffffff</item>
</style>
Update
Wie @Justin Powell vorgeschlagen, dass ich die actionBarStyle
zu meinem Thema hinzufügen, aber immer noch gibt es keinen Schlagschatten.
MyTheme Stil (aktualisiert)
<style name="MyTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="android:textColorPrimary">@color/abc_primary_text_material_dark</item>
<item name="actionMenuTextColor">@color/abc_primary_text_material_dark</item>
<item name="android:textColorSecondary">#ffff8800</item>
<item name="android:actionBarStyle">@style/Widget.AppCompat.Light.ActionBar.Solid.Inverse</item>
</style>
Mögliche Duplikat von [Wie die Schatten der ActionBar & Toolbar der Support-Bibliothek zeigen auf alle Android-Versionen?] (http://stackoverflow.com/questions/27474766/how-to-sho w-the-shadow-of-the-actionbartoolbar-of-the-support-library-on-all-an) – rds