android – 如何将加载指示符添加到AutoCompleteTextView

android – 如何将加载指示符添加到AutoCompleteTextView,第1张

概述我想在从Web服务加载数据时在AutoCompleteTextView中显示加载指示器.优选地,它应该显示在自动完成的右侧(f.i.动画像进行中控制 – 旋转轮).怎么做到这一点? I would like to show loading indicator in AutoCompleteTextView while loading data from web-service. 在窗口小部件的右侧 我想在从Web服务加载数据时在autoCompleteTextVIEw中显示加载指示器.优选地,它应该显示在自动完成的右侧(f.i.动画像进行中控制 – 旋转轮).怎么做到这一点?解决方法

I would like to show loading indicator in autoCompleteTextVIEw while
loading data from web-service.

在窗口小部件的右侧放置一个带有不确定外观的Progressbar,并像这样扩展autoCompleTextVIEw类:

public class autoCompleteLoadding extends autoCompleteTextVIEw {    private Progressbar mloadingIndicator;    public voID setLoadingIndicator(Progressbar vIEw) {        mloadingIndicator = vIEw;    }    @OverrIDe    protected voID performFiltering(CharSequence text,int keyCode) {        // the autoCompleteTextvIEw is about to start the filtering so show        // the Progresspager        mloadingIndicator.setVisibility(VIEw.VISIBLE);        super.performFiltering(text,keyCode);    }    @OverrIDe    public voID onFilterComplete(int count) {        // the autoCompleteTextVIEw has done its job and it's about to show        // the drop down so close/hIDe the Progreebar        mloadingIndicator.setVisibility(VIEw.INVISIBLE);        super.onFilterComplete(count);    }}

使用setLoadingIndicator()方法将引用传递给Progressbar.这假设您在适配器(autoCompleteTextVIEw)/适配器的过滤器中发出Web服务请求.

总结

以上是内存溢出为你收集整理的android – 如何将加载指示符添加到AutoCompleteTextView全部内容,希望文章能够帮你解决android – 如何将加载指示符添加到AutoCompleteTextView所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1130319.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-30
下一篇 2022-05-30

发表评论

登录后才能评论

评论列表(0条)

保存