简体   繁体   English

ImageView的Android小部件动画

[英]Android Widget animation for ImageView

I have one Widget with сouple of TextViews and one ImageView . 我有一个带有少量TextViews小部件和一个ImageView Whenever user click on the ImageView I am refreshing widget data in the background. 每当用户单击ImageView我都会在后台刷新小部件数据。 This process takes some time. 此过程需要一些时间。 Meanwhile, I want to show small custom animated loader in the ImageView place. 同时,我想在ImageView位置显示小型自定义动画加载器。

For ImageView click I use the following statement on the widget: 对于ImageView单击我在小部件上使用以下语句:

 Views.setOnClickPendingIntent(R.id.ImageView, loadIntent);

Could anyone guide me how to implement this functionality? 谁能指导我如何实现此功能?

在此处输入图片说明

Take one progress bar in your widget layout 在小部件布局中占据一个进度条

When you receive click event of your refresh button make progress bar's visibility to visible: 当您收到刷新按钮的点击事件时,使进度条的可见性可见:

views.setViewVisibility(R.id.img_refresh, View.GONE);
views.setViewVisibility(R.id.pb_widget, View.VISIBLE);

After your process complete for refreshing data make image visible and progress bar to gone: 完成刷新数据的过程后,使图像可见,进度条消失:

views.setViewVisibility(R.id.img_refresh, View.VISIBLE);
views.setViewVisibility(R.id.pb_widget, View.GONE);

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

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