自定义主页图标在操作栏福尔摩斯 [英] Custom Home Icon in Action Bar Sherlock

查看:140
本文介绍了自定义主页图标在操作栏福尔摩斯的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图设置自定义图标使用 ActionBarSherlock库的主页图标。我曾尝试使用 abHomeLayout 属性在我的自定义主题设置自定义布局。但是,这并不为我工作。只有这样,如何​​设置它,是设置 abIcon 属性为我定制drawble,但我不能设置一些水平填充这个绘制。有没有例子这或者可以用 abHomeLayout 属性的问题?

I am trying to set custom icon for home icon using ActionBarSherlock library. I have tried to set custom layout using abHomeLayout attribute in my custom theme. But it didn't work for me. Only way, how to set it, is to set abIcon attribute for my custom drawble, but I cannot set some horizontal padding for this drawable. Is there any example for this or where could be a problem with abHomeLayout attribute?

推荐答案

这适用于我的情况,它用我的自定义的操作栏中的默认ic_launcher图标。

This works for my situation, it replaces the default ic_launcher icon in the action bar with my custom one.

在您的onCreate做到这一点:

In your onCreate do this:

getSupportActionBar().setIcon(R.drawable.audio_shortcut);

或者在清单中可以设置标志:

Or in the manifest you can set the logo:

<activity>
    android:logo="@drawable/my_custom_logo"
    ...
</activity>

这篇关于自定义主页图标在操作栏福尔摩斯的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆