首页 \ 问答 \ 改变ProgressBar的可见性会导致关闭(Changing visibility of ProgressBar causes force close)

改变ProgressBar的可见性会导致关闭(Changing visibility of ProgressBar causes force close)

我有一个包含WebView的布局,以及以它为中心的ProgressBar。 进度条需要显示并且保存为程序(当网页内容加载时)。 但是,将ProgressBar设置为使用loading.setVisibility(View.VISIBLE);可见loading.setVisibility(View.VISIBLE); ,导致一个力量关闭。 如果ProgressBar默认是可见的,那么它工作正常。 如果需要,我会粘贴所有适当的代码,但我怀疑我正在做一些根本性的错误。

(应该有强制关闭标记,但它既不强制关闭也不存在,我无法创建它。)

好的,代码。 setVisibility简单地说就是:

  public void nowLoading() {
        loading.setVisibility(View.VISIBLE);
    }

nowLoading被称为...通过JavaScript,与WebView上的addJavascriptInterface。 啊...我想象WevView是在一个不同的线程。 我如何解决这个问题?


I have a layout containing a WebView, and a ProgressBar centred on top of it. The progress bar needs to be shown and hid programatticaly (as web content loads). However, setting the ProgressBar to be visible using loading.setVisibility(View.VISIBLE);, causes a force close. If the ProgressBar is visible by default it works fine. I will paste all appropriate code if needed, but I suspect I'm doing something fundamentally and simply wrong.

(should have force-close tag but neither it nor forceclose exists and I can't create it.)

Okay, code. The setVisibility is simply:

  public void nowLoading() {
        loading.setVisibility(View.VISIBLE);
    }

nowLoading is called... via javascript, with addJavascriptInterface on the WebView. Ahh... I imagine the WevView is in a different Thread. How do I solve that?


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

最满意答案

在复制/粘贴操作期间,源和目标之间有内容类型协商。 它发生的有点像这样:

  1. 您将某些内容复制到复制和粘贴缓冲区中。 复制的数据或多或少都标记为MIME类型,并放置在那里。
  2. 粘贴时,粘贴目标会告知复制粘贴系统,它理解特定的MIME类型列表。
  3. 复制粘贴系统将可用格式与所需格式相匹配,并在两个列表中找到text/html
  4. 有人(可能是数据的原始来源)然后将粘贴缓冲区转换为text/html并将其放入编辑器中。

当我在做X11 / Motif开发时(嘿,放下我的草坪,让你烂的孩子!),这就是事情的方式。所以我猜测每个人都会以同样的方式做出这样的事情。


There's a content type negotiation between the source and target during the copy/paste operation. It happens sort of like this:

  1. You copy something into the copy and paste buffer. The copied data is tagged with, more or less, a MIME type and who put it there.
  2. When you paste, the paste target tells the copy-and-paste system that it understands a specific list of MIME types.
  3. The copy-and-paste system matches the available formats to the desired formats and finds text/html in both lists.
  4. Someone (probably the original source of the data) then converts the paste buffer to text/html and drops it in the editor.

That's pretty much how things worked back when I was doing X11/Motif development (hey! get off my lawn you rotten kids!) so I'd guess that everyone does it pretty much the same way.

相关问答

更多
  • 如果你的用户可以处理所见即所得,我会去那。 我正在考虑你的系统将是可视化的,也就是说,如果你说什么是一个标题,它将看起来像一个标题(否则WYS部分将不适用)。 如果用户必须手动输入标记,那么只有最精明的技术用户才能够处理它。 我对大多数用户所看到的是,他们无法给文档中的内容赋予意义。 他们不认为“这是一个标题”,他们认为“这应该更大胆和更大胆”。 不能认为“这是一个标题”的人不能处理所见即所得的问题,否则他们会觉得很难。 谁将成为您的用户群? 如果是人们撰写学术论文,我会与所见即所得一起去,因为他们在处理它 ...
  • 此weblink 兼容性表用于在桌面和移动浏览器中支持contenteditable属性。 会给你一个关于这个问题的线索。 我今天正在寻找同样的东西,所以我想与你分享这个链接。 This weblink Compatibility table for support of contenteditable attribute in desktop and mobile browsers. will give you a clue about this issue. I was looking for the ...
  • 不是真的。 有关不完善选项的解释和列表,请阅读此页面 。 但是,您可能不需要WYSIWYG编辑器,以便对wiki进行多种快速编辑。 可以下载页面的维基文本,在本地进行编辑并提交更改。 有脚本(称为机器人)可以做到这一点。 一个例子是pywikipediabot的“editarticle.py”脚本。 您可能还想看看AutoWikiBrowser 。 Not really. For an explanation and a list of imperfect options, read this page. ...
  • 在复制/粘贴操作期间,源和目标之间有内容类型协商。 它发生的有点像这样: 您将某些内容复制到复制和粘贴缓冲区中。 复制的数据或多或少都标记为MIME类型,并放置在那里。 粘贴时,粘贴目标会告知复制粘贴系统,它理解特定的MIME类型列表。 复制粘贴系统将可用格式与所需格式相匹配,并在两个列表中找到text/html 。 有人(可能是数据的原始来源)然后将粘贴缓冲区转换为text/html并将其放入编辑器中。 当我在做X11 / Motif开发时(嘿,放下我的草坪,让你烂的孩子!),这就是事情的方式。所以我猜测 ...
  • 我不认为任何人都可以对这个问题作出权威的回答,但是我从来没有听说过一个不同的Javascript WYSIWYG编辑器。 堆栈溢出在服务器端不同。 如果您寻找服务器端组件来完成这项工作,您可能会有更好的运气。 如果您需要将差异显示为用户类型或类似内容,则可以使用AJAX将diff工作交给服务器。 I don't think anyone can authoritatively answer no to this question, but I've never heard of a Javascript W ...
  • 瑞恩格罗夫的净化宝石是非常可定制的,我认为basic或relaxed模式可以用于从WYSIWYG编辑器中清理原始html(并且您不必将一堆标签列入白名单)。 Ryan Grove's sanitize gem is very customizable, and I think the basic or relaxed modes would work for sanitizing raw html from the WYSIWYG editor (and you wouldn't have to white ...
  • 你不应该试图自己写这种保护。 特别是,您不应该在客户端(javascript)上放置保护,而是使用像http://htmlpurifier.org/这样的服务器端过滤 You shouldn't try to write such protection on your own. Specially, you should NOT place the protection on the client side (javascript), but use instead a server side filter ...
  • TinyMCE是一款流行的JavaScript所见即所得编辑器,它支持BBcode模式。 以下是BBcode示例页面的链接: http://tinymce.moxiecode.com/examples/example_09.php TinyMCE is a popular javascript WYSIWYG editor, and it supports a BBcode mode. Here's a link to their BBcode example page: http://tinymce.mo ...
  • 我发现了一个解决方案,可以使用contenteditable div以及Ionic的Trix编辑器。 我将此类应用于CSS,现在我没有遇到任何问题,无论是在浏览器中还是在真实设备上进行测试: .editable{ user-select: text; -webkit-user-select: text; pointer-events: all !important; -webkit-user-modify:read-write !important; } I foun ...
  • EditText完全能够显示丰富的文本。 只是用户 - 甚至开发人员 - 没有简单的方法来真正控制格式。 因此,我一直在寻找一个库来处理这个问题 ,为EditText提供RichEditText替代品。 它仍然是一项正在进行的工作,我真的需要在不久的将来花更多的时间在它上面。 EditText is perfectly capable of displaying rich text. It's just that there's no easy way for users -- or even develo ...

相关文章

更多

最新问答

更多
  • 您如何使用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)