问题描述
我正在开发一个使用Android应用程序 ActionBarSherlock ,提供的。
I'm developing an Android application that uses ActionBarSherlock with SlidingMenu.
现在,我这是怎么表现的按钮打开菜单:
Now, this is how I show the button to open the menu:
但不想显示<在左,并改变其图标的自定义。
But don't want to show that < in left, and change its icon for a custom.
这是我如何设置滑动菜单:
This is how I set up Sliding Menu:
private void setUpSlidingMenuAndActionBar()
{
setBehindContentView(R.menu.menu);
setSlidingActionBarEnabled(true);
slidingMenu = getSlidingMenu();
slidingMenu.setMode(SlidingMenu.LEFT);
slidingMenu.setSlidingEnabled(false);
slidingMenu.setBehindOffset(100);
getSupportActionBar().setDisplayShowCustomEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
如何删除&LT;左边的图标并更改主页按钮图标?
当我点击该按钮我打开滑动菜单。
When I tap on that button I open the sliding menu.
更新:
随着黑带的答案,这是我做的:
Following blackbelt answer, this is what I did:
styles.xml
<style name="AppTheme.ActionBarStyle" parent="@style/Theme.Sherlock">
<item name="android:homeAsUpIndicator">@drawable/but_menu</item>
<item name="homeAsUpIndicator">@drawable/but_menu</item>
</style>
的Manifest.xml:
<application
[ ... ]
android:theme="@style/AppTheme.ActionBarStyle" >
结果:
我可以看到绿色的Android!我不希望看到它!
I can see the green Android!!! I don't want to see it!!
推荐答案
使用homeAsUpIndicator内部风格
Use homeAsUpIndicator inside styles
<item name="android:homeAsUpIndicator">@drawable/home_up_drawable</item>
<item name="homeAsUpIndicator">@drawable/home_up_drawable</item>
我的是这样的:
Mine looks like:
<style name="AppTheme.ActionBarStyle" parent="@style/Widget.Sherlock.ActionBar.Solid">
<item name="android:homeAsUpIndicator">@drawable/home_up_drawable</item>
<item name="homeAsUpIndicator">@drawable/home_up_drawable</item>
<item name="android:titleTextStyle">@style/AppTheme.TitleTextStyle</item>
<item name="android:background">@drawable/actionbar_background</item>
<item name="background">@drawable/actionbar_background</item>
<item name="android:displayOptions">showHome|useLogo</item>
<item name="displayOptions">showHome|useLogo</item>
<item name="android:windowContentOverlay">@null</item>
<item name="windowContentOverlay">@null</item>
</style>
这篇关于显示在ActionBarSherlock自定义按钮,显示一个滑动菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!