本文介绍了填充的动作条"向上QUOT;指示器图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在寻找一种方式来风格的动作条的向上图标,那就是当你配置它从你的Activity显示显示:

I'm in search of a way to style the ActionBar's "up" icon that is displayed when you configured it to be displayed from your Activity :

getSupportActionBar().setDisplayHomeAsUpEnabled(true);

我一直在环顾四周,发现了一种家的图标和标题之间添加填充物(Padding之间ActionBar的家图标和标题的),而不是一个方式到家庭图标和向上指示器图标之间添加填充物

I've been looking around and found a way to add padding between the home icon and the title (Padding between ActionBar's home icon and title), but not a way to add padding between the home icon and the up indicator icon.

我挖成 ActionBarView.HomeView 在Android源代码,它似乎吹通过这种调用了指示:

I dug into ActionBarView.HomeView in the android source and it appears to inflate the up indicator via this call :

mUpView = findViewById(com.android.internal.R.id.up);

问题是 com.android.internal.R.id.up 是内部的,所以我不能访问它,所以填充的主页图标上面的链接的解决方案将无法正常工作。理想情况下,我想重写 ActionBarView.HomeView ,但它的内部私有的 ActionBarView

Problem is the com.android.internal.R.id.up is internal so I can't access it, so the above linked solution for padding the home icon won't work. Ideally I'd like to override the ActionBarView.HomeView, but it's private within the ActionBarView.

有谁知道,如果ActionBarSherlock提供了覆盖这种行为的好办法?我看着提供自定义主页的布局,但我发现线程表示,它不会从标准的Andr​​oid类分歧是一个好主意。

Does anyone know if ActionBarSherlock provides a good way to override this behavior? I've looked into providing a custom home layout, but the threads I found indicated that it wouldn't be a good idea to diverge from the standard android classes.

任何想法?

推荐答案

截至15 API,这些元素的定位是硬codeD插入布局资源。你唯一的选择是使用自定义导航布局,以创建自己的和隐藏内置家庭导航。

As of API 15 the positioning of these elements are hard-coded into the layout resources. The only alternative you have would be to use a custom navigation layout to create your own and hide the built-in home navigation.

这篇关于填充的动作条"向上QUOT;指示器图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-25 16:57