在滑动菜单中更改导航图标

时间:2014-07-05 20:20:40

标签: android actionbarsherlock slidingmenu android-sliding

我正在jfeinstein10使用滑动菜单,在这里我成功设置了滑动菜单的自定义导航图标。

我已经在我的style.xml中完成了它,比如

<style name="AppBaseTheme" parent="@style/Theme.Sherlock.Light">
    <!-- API 14 theme customizations can go here. -->
        <item name="homeAsUpIndicator">@drawable/ic_navigation_drawer</item>

</style>

现在,如果我打开一个新活动,我也会看到自定义主页指示符图标&amp;我没有在我从滑动菜单打开的新活动中获得默认后退箭头。

例如:在Gmail中,默认情况下,如果我们滑动,导航图标将出现在所有邮件视图中。但是,如果我们去撰写新的电子邮件,homeupindicator图标会改变,怎么办?

1 个答案:

答案 0 :(得分:1)

这是解决方案

A detailed explanation of changing the actionbar homeasupindicator

Change the actionbar homeAsUpIndicator Programamtically

这是我为实现这一行为所做的。我继承了基本主题并创建了一个新主题,将其用作特定活动的主题。

<style name="CustomActivityTheme" parent="AppTheme">
    <item name="android:homeAsUpIndicator">@drawable/custom_home_as_up_icon</item>
</style>

并在android清单中我将活动主题设为上述。

<activity
        android:name="com.example.CustomActivity"
        android:theme="@style/CustomActivityTheme" >
</activity>

效果很好。对于所有活动来说,它就像魅力一样。

相关问题