android - 自定义 Actionbar 的后退按钮

标签 android

enter image description here enter image description here

<style name="MyActionBar.ActionBarStyle" parent="@android:style/Widget.Holo.Light.ActionBar">
    <item name="android:background">@drawable/button_style</item>
    <item name="android:titleTextStyle">@style/MyTheme.ActionBar.TitleTextStyle</item>
</style> 

如何自定义 actibar 的向上导航按钮。实际上,我希望它的颜色在我单击时发生变化。例如 Whatsapp,当我单击后退按钮时,按钮的背景颜色变为蓝色。 我该怎么做?

最佳答案

您必须为项目的自定义主题覆盖 android:homeAsUpIndicator

<!-- Base application theme. -->
    <style name="AppTheme" parent="android:Theme.Holo.Light">
          <item name="android:homeAsUpIndicator">@drawable/ic_action_up_caret</item>
    </style>

然后在您的 list 文件中将您的自定义设置为应用主题(如果您还没有的话):

<application
        android:name="com.example.app"
        android:theme="@style/AppTheme" >

关于android - 自定义 Actionbar 的后退按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27026661/

相关文章:

android - 如何只清除应用程序的缓存而不清除其他数据(共享偏好)

java - 无法将上下文转换为 fragment 的 FragmentAdapter 中的 CustomCallBack 接口(interface)

java - 通过 Maven 构建排除一些类

android - Android 中的组合首选项

android - 显示来自特定 channel 的 Youtube 视频

android - 在 Android 4.4 中从图库中选择时进行裁剪

java - 如何使用按钮在android中打开另一个 Activity

Android Studio MediaStore Storage 无法访问文件夹

android - 使用回收者 View 播放 youtube 视频

java - 在使用xml的android TextView中使用自定义字体