首页 \ 问答 \ 奇怪的SearchView行为(Strange SearchView behaviour)

奇怪的SearchView行为(Strange SearchView behaviour)

我最初使用ActionBarSherlock工作,但自从重新使用我的代码以使用android.support.v7库时,我在SearchView展开时看到一个模糊的蓝色叠加层。

以下是我的Nexus 7的屏幕截图,软键盘处于打开状态。

在此处输入图像描述

当我关闭键盘时,模糊的蓝色图像消失,但SearchView仍然存在模糊,如下图所示。

在此处输入图像描述

我正在使用菜单xml文件来创建各种菜单项 - 搜索项目如下...

<item android:id="@+id/options_menu_search"
    android:title="@string/search"
    android:icon="@android:drawable/ic_menu_search"
    com.mycompany.mypackage:showAsAction="ifRoom|collapseActionView"
    com.mycompany.mypackage:actionViewClass="android.support.v7.widget.SearchView" >
</item>

它实际上在我可以执行搜索的意义上工作,但对于我的生活,我无法解决模糊图像来自哪里。

我确实发现ActionBar中的这个SearchView drawables显得模糊,但是接受的答案不适用于我的问题,因为我没有以编程方式创建SearchView。

有没有人见过类似的东西并找到了修复方法?


I originally had this working with ActionBarSherlock but since re-working my code to use the android.support.v7 libraries I'm seeing a blurred blue overlay when the SearchView is expanded.

The following is a screenshot from my Nexus 7 with the soft keyboard open.

enter image description here

When I close the keyboard the blurred blue image disappears but there is still a blur to the SearchView as in the image below.

enter image description here

I'm using a menu xml file to create the various menu items - the search item is as follows...

<item android:id="@+id/options_menu_search"
    android:title="@string/search"
    android:icon="@android:drawable/ic_menu_search"
    com.mycompany.mypackage:showAsAction="ifRoom|collapseActionView"
    com.mycompany.mypackage:actionViewClass="android.support.v7.widget.SearchView" >
</item>

It does actually work in the sense I can perform searches but for the life of me I can't work out where the blurred images are coming from.

I did find this SearchView drawables in ActionBar appear blurred but the accepted answer doesn't apply to my problem as I'm not creating the SearchView programatically.

Has anybody seen anything similar and found a fix?


原文:https://stackoverflow.com/questions/19576675
更新时间:2022-07-06 19:07

最满意答案

你可以尝试我写的这个扩展方法来解决类似的问题

public static async Task<bool> TryToAsync( Action action, int timeoutInSeconds )
        {
            var timeout = DateTime.Now.AddSeconds( timeoutInSeconds );
            while ( DateTime.Now < timeout )
            {
                try
                {
                    action();
                    return true;
                }
                catch ( Exception )
                {
                    await Task.Delay( 200 );
                }
            }

            return false;
        }

you can try this extension method which I wrote to solve similar type of problem

public static async Task<bool> TryToAsync( Action action, int timeoutInSeconds )
        {
            var timeout = DateTime.Now.AddSeconds( timeoutInSeconds );
            while ( DateTime.Now < timeout )
            {
                try
                {
                    action();
                    return true;
                }
                catch ( Exception )
                {
                    await Task.Delay( 200 );
                }
            }

            return false;
        }

相关问答

更多
  • 它不是AssignFile()失败,而是在具有Hidden属性集的文件上调用Rewrite() 。 以下解释: 通常,您调用Rewrite(F)以擦除文件并使用后续的Write(F, ...)或WriteLn(F, ...)调用将新数据Write(F, ...) 。 来自docs(System.Rewrite): 如果已存在具有相同名称的外部文件,则会将其删除,并在其位置创建新的空文件。 使用Append()命令打开文件进行写入没有问题。 (基于上面我得出的结论是,删除失败并且拒绝访问消息。这太过分了。) ...
  • 我认为卡尔是对的。 我曾经有过类似的情况,而我所做的是删除相关文件,清理解决方案,然后重建。 如果项目需要该文件,则应重新创建它; 在我的情况下,它不需要它,因为它从来没有重新创建它,但项目运行得很好。 我会推荐另一件事; 您可能会选择关闭父文件夹的只读属性,然后选择此设置以遍历所有子文件夹和文件,但这并不意味着发生了这种情况。 对于所有的子文件夹和文件(特别是那些出现错误的文件夹),单独检查每个文件夹并确保只读属性关闭。 I think Karl has it right. I had a similar ...
  • 您无法使用JavaScript访问客户端文件,访问文件的唯一方法是首先将其上载到服务器或Flash应用程序。 You cant access client side files with JavaScript , the only way to access files is to first upload it to the server or to a flash application.
  • 您必须假设您可能无权访问硬盘驱动器上的某些文件和文件夹。 一种解决方案是使用管理员级权限手动运行应用程序,但更容易修改清单文件,以便应用程序在运行时自动寻找管理员级别。 您可以通过向项目添加mainifest文件来执行此操作(添加新项目...)。 然后改变线 " 至
  • 原因是因为您的SQL-Server进程(如果未另外指定)运行,而不是myo.minlin帐户。 启动该进程的帐户对您提供的文件没有权限。 这很好,因为数据库不应该能够访问您的私人文件。 有三种甚至更多可能的解决方案: 将文件移动到SQL-Server有权访问的位置。 确保运行SQL Server的帐户具有执行文件的正确权限 使用myo.milin帐户启动SQL Server进程。 我不推荐解决方案3.如果文件位于您的主目录中,也不建议使用解决方案2。 请参阅配置Windows服务帐户和权限 。 The re ...
  • 如mkelem提示页面中所述 : 在元素创建过程中,重命名view-private文件以防止会影响其他Rational®ClearCase®工具的名称冲突(例如, mkelem操作上的触发器)。 如果此重命名失败,您会看到一条警告消息。 如果检出新元素,mkelem会使用.mkelem (或可能是.mkelem.n )后缀临时重命名view-private文件。 创建并检出新元素后,mkelem将恢复原始名称。 此操作产生预期效果:以前在视图专用文件中的数据现在可通过具有相同名称的元素访问。 如果mkele ...
  • Google App Engine文档讨论了“白名单”文件。 这是在玩吗? 我也想知道这个: File file = new File("//warChildFolder//myFile.txt"); 主导斜线不是使这个绝对路径? 我会尝试这样的: File file = new File("WEB-INF/warChildFolder/myFile.txt"); 制作相对于WAR根的路径并明确指出WEB-INF。 Google App Engine docs talk about "white lis ...
  • 你可以尝试我写的这个扩展方法来解决类似的问题 public static async Task TryToAsync( Action action, int timeoutInSeconds ) { var timeout = DateTime.Now.AddSeconds( timeoutInSeconds ); while ( DateTime.Now < timeout ) { ...
  • 你错误地使用py而不是python来执行你的脚本。 这会导致您收到的消息。 You are mistakenly using py instead of python to execute your script. This causes the messages you are getting.
  • 在您运行已具有管理员权限的批处理文件的情况下,可能会导致访问被拒绝错误消息 当前要由应用程序打开的目录中的文件,或 要移动的目录是正在运行的进程(批处理文件)的当前目录,或者 管理员帐户对您的桌面文件夹没有任何权限,但这是不太可能的,因为它是用户配置文件中的文件夹,而不是管理员帐户的用户配置文件。 在前两种情况下,无法删除指定的目录,结果是共享访问被拒绝错误消息。 因此,目标文件夹中的权限可能不是此处的问题,而是源文件夹及其文件的共享访问权限。 顺便说一句:更好地使用move "%~dp0test" "%P ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)