如何自定义"向上QUOT;当搜索查看正在扩大按钮? [英] How to customize the "up" button when the searchView is being expanded?

查看:172
本文介绍了如何自定义"向上QUOT;当搜索查看正在扩大按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序 有搜索使用的动作条的搜索查看项目(这是其他应用程序)的能力。

My app has the ability to search for items (which are other apps) using the SearchView on the ActionBar.

该应用程序使用谷歌的支持库,和它运作良好,在所有版本的Andr​​oid的API 9。

The app uses the support library of Google, and it works well on all versions of Android from API 9 .

在棒棒糖,当我点击才能开始搜索的搜索行动项目,我注意到,在左上角的向上/后退按钮到达是白色的,这是不好的这种情况下,因为动作条背景也很白很白:

On Lollipop, when I click the search action item in order to start searching, I notice that the up/back button on the top-left corner gets to be white, which is bad for this case since the actionbar background is also quite white:

奇怪的是,它并不总是发生,我不认为这会发生在未棒棒糖(在多个仿真器和设备测试)的Andr​​oid版本。

Weird thing is that it doesn't always occur, and I don't think it occurs on Android versions that aren't Lollipop (tested on multiple emulators and devices).

另一个奇怪的是,抽屉式导航图标似乎确定,以及对搜索查看里面的X图标。

Another weird thing is that the navigation drawer icon seems ok, as well as the X icon inside the searchView.

下面的工具栏我的XML:

Here's the XML of the toolbar I have:

<android.support.v7.widget.Toolbar
    android:id="@+id/activity_app_list__toolbar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="?attr/colorPrimary"
    android:minHeight="?attr/actionBarSize" />

的colorPrimary被设定为:#ffEFEFEF

the "colorPrimary" is set to be : #ffEFEFEF .

此外,活动主题的父是Theme.AppCompat.Light.NoActionBar,因为我已经设置工具栏是动作条。

Also, the theme's parent of the activity is "Theme.AppCompat.Light.NoActionBar" , as I've set the toolbar to be the actionBar.

我该如何解决这个问题?

How can I fix this issue?

是什么原因这个问题?为什么它工作正常,在其他Android版本?

What is the cause for this issue? How come it works fine on other Android versions?

推荐答案

这似乎是一个已知的问题:<一href="https://$c$c.google.com/p/android/issues/detail?id=78346">https://$c$c.google.com/p/android/issues/detail?id=78346 。

It seems like a known issue: https://code.google.com/p/android/issues/detail?id=78346 .

解决方法是在这里:<一href="https://$c$c.google.com/p/android/issues/detail?id=78346#c5">https://$c$c.google.com/p/android/issues/detail?id=78346#c5 ,意思是:

workaround is here: https://code.google.com/p/android/issues/detail?id=78346#c5 , meaning:

值-21 /的themes.xml:

<style name="MyTheme" parent="Theme.AppCompat">
    <item name="homeAsUpIndicator">@drawable/abc_ic_ab_back_mtrl_am_alpha</item>
</style>

就是这样。希望它被固定以后。

That's it. Hope it gets fixed later.

为了对其进行自定义,我想我可以使用它,并且还用选择颜色colorControlNormal

In order to customize it, I assume I can use it, and also choose the color using "colorControlNormal"

这篇关于如何自定义&QUOT;向上QUOT;当搜索查看正在扩大按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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