简体   繁体   English

如何使用动作栏中的微调按钮更改按钮以加载?

[英]How to change the button with a spinner in actionbar to loading?

I have a webview and want to listen its loading event and I have a refresh button on my actionbar. 我有一个Web视图,想听其加载事件,并且我的操作栏上有一个刷新按钮。

How to change the button to a spinner programmatically? 如何以编程方式将按钮更改为微调框?

You can't magically change a button into a spinner. 您无法神奇地将按钮更改为微调框。 What you can do is disable the button and enable the spinner. 可以做的就是禁用按钮并启用微调器。

myButton.setEnabled(false);
mySpinner.setEnabled(true);

If you want to make the spinner take the place of the button, then you're going to have to put all of your layout drawing routine into a buildLayout() (or whatever you want to call it) and redraw the entire layout with a button or with a spinner, depending on the state of your application. 如果您想让微调框代替按钮,则必须将所有布局绘图例程放入buildLayout()(或任何您想调用的东西)中,并使用按钮或微调器,具体取决于应用程序的状态。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM