隐形ActionMode项目图标Theme.Sherlock.Light.DarkActionBar [英] Invisible ActionMode item icons in Theme.Sherlock.Light.DarkActionBar

查看:176
本文介绍了隐形ActionMode项目图标Theme.Sherlock.Light.DarkActionBar的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用 Theme.Sherlock.Light.DarkActionBar (或 Theme.Holo.Light.DarkActionBar ,没有按'吨有所作为),所述ActionMode(或上下文动作条)选择文本时出现,例如,是通过默认的样式相同的方式,在标准黑暗的主题,即深蓝色光动作图标

When using Theme.Sherlock.Light.DarkActionBar (or Theme.Holo.Light.DarkActionBar, doesn't make a difference), the ActionMode (or "contextual ActionBar") that appears for example when selecting text, is by default styled the same way as in the standard dark theme, that is dark blue with light action icons.

不过,当您试图选择在一个对话框文本(也就是光风格在这个主题,在对比的是黑色的动作条),风格作为光主题的ActionMode(白色背景)出现代替。现在的问题是,它的操作图标不深,因为他们是应该的,但是光,使它们有效地看不见的。

However, when you try to select a text in a Dialog (which is light-styled in this theme, in contrast to the black ActionBar), an ActionMode styled as in the Light theme (white background) appears instead. The problem is, that its action icons are not dark as they should be, but light, making them effectively invisible.

这好像背景拍摄(因为光线对话框)从光的主题,但是它们的图标取自黑暗的主题。这是在 Light.DarkActionBar 主题的错误?我能做些什么呢?

This seems as if the background was taken from the light theme (because of the light dialog), but the icons were taken from the dark theme. Is this a bug in the Light.DarkActionBar theme? Can I do something about it?

推荐答案

我用同样的问题,因为过去两天的战斗。最后,我想出了一个解决办法!

I was fighting with the same issue since last two days. Finally I came up with a workaround!

我使用的是 DialogFragment AlertDialog 对象。在 onCreateDialog()方法,我们所要做的就是让父活动的背景下,并重新设置主题为 Theme.Light

I am using a DialogFragment with an AlertDialog object. In the onCreateDialog() method, all we have to do is get the context of the parent activity and set its theme again to Theme.Light.

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    //get the parent activity context and set it's theme again.
    Context ctx = getActivity();
    ctx.setTheme(android.R.style.Theme_Holo_Light);
    AlertDialog.Builder builder = new AlertDialog.Builder(ctx);
    LayoutInflater inflater = (LayoutInflater) ctx.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View view = inflater.inflate(R.layout.your_dialog_layout, null, false);
    builder.setView(view);

    //your other code for the dialog
    //

    return builder.create();

现在的语境动作条的图标的EditText 有合适的颜色。

这篇关于隐形ActionMode项目图标Theme.Sherlock.Light.DarkActionBar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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