本文介绍了如何自定义 ActionBar 上的后退按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我已经能够使用以下建议自定义操作栏的背景、徽标图像和文本颜色:
Android:如何更改操作栏主页"图标不是应用图标?
ActionBar 文本颜色
ActionBar 背景图片

I have been able to customize the action bar's background, logo image and text color using suggestions from these:
Android: How to change the ActionBar "Home" Icon to be something other than the app icon?
ActionBar text color
ActionBar background image

我想自定义的最后一块是后退按钮图像.默认情况下它是灰色的,我希望它是白色的.更改颜色、指定可绘制对象或简单地使其透明(并将 V 形添加到我的自定义徽标图像)都可以.我该怎么做?

The last piece I want to customize is the back button image. It's grey by default and I would like it to be white. Either changing the color, specifying a drawable or simply making it transparent (and adding the chevron to my customized logo image) would work. How do I go about that?

推荐答案

向上"可见性指示器由主题的 homeAsUpIndicator 属性中指定的可绘制对象提供.要使用您自己的自定义版本覆盖它,它将是这样的:

The "up" affordance indicator is provided by a drawable specified in the homeAsUpIndicator attribute of the theme. To override it with your own custom version it would be something like this:

<style name="Theme.MyFancyTheme" parent="android:Theme.Holo">
    <item name="android:homeAsUpIndicator">@drawable/my_fancy_up_indicator</item>
</style>

如果您的应用程序支持 3.0 之前的版本,请确保将此版本的自定义主题放在 values-v11 或类似文件中.

If you are supporting pre-3.0 with your application be sure you put this version of the custom theme in values-v11 or similar.

这篇关于如何自定义 ActionBar 上的后退按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 18:52