gpt4 book ai didi

Android AppWidget如何播放Gif?

转载 作者:行者123 更新时间:2023-11-29 02:41:32 24 4
gpt4 key购买 nike

使用滑行库。这就像正常的照片。我尝试了 glide 库,但它没有用。使用滑行库。这就像正常的照片。我尝试了 glide 库,但它没有用。

 public class NewAppWidget extends AppWidgetProvider {
private static AppWidgetTarget appWidgetTarget;

static void updateAppWidget(Context context, AppWidgetManager appWidgetManager,
int appWidgetId) {

CharSequence widgetText = NewAppWidgetConfigureActivity.loadTitlePref(context, appWidgetId);
// Construct the RemoteViews object
RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.new_app_widget);
views.setTextViewText(R.id.appwidget_text, widgetText);
RemoteViews rv = new RemoteViews(context.getPackageName(), R.layout.new_app_widget);

appWidgetTarget = new AppWidgetTarget( context, rv, R.id.imageView, appWidgetId );

Glide
.with( context.getApplicationContext() ) // safer!
.load("https://i.giphy.com/l4FGq1K2WUMWYSisw.gif")
.asBitmap()
.into(appWidgetTarget);
pushWidgetUpdate(context, rv);

appWidgetManager.updateAppWidget(appWidgetId, rv);
}
public static void pushWidgetUpdate(Context context, RemoteViews rv) {
ComponentName myWidget = new ComponentName(context, NewAppWidget.class);
AppWidgetManager manager = AppWidgetManager.getInstance(context);
manager.updateAppWidget(myWidget, rv);
}
@Override
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
// There may be multiple widgets active, so update all of them
for (int appWidgetId : appWidgetIds) {
updateAppWidget(context, appWidgetManager, appWidgetId);

RemoteViews rv = new RemoteViews(context.getPackageName(), R.layout.new_app_widget);

appWidgetTarget = new AppWidgetTarget( context, rv, R.id.imageView, appWidgetIds );

Glide
.with( context.getApplicationContext() ) // safer!
.load("https://i.giphy.com/l4FGq1K2WUMWYSisw.gif")
.asBitmap()
.into(appWidgetTarget);
pushWidgetUpdate(context, rv);
}

}

我的英语不好,我已经道歉了,我可以告诉你我可以告诉你。谢谢

最佳答案

ImageView 不显示动画 GIF 的动画。没有任何小部件可以进入将播放动画 GIF 动画的应用程序小部件。

关于Android AppWidget如何播放Gif?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43710242/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com