草庐IT

remoteViews

全部标签

android - 如何在 remoteview 的帮助下创建 Listview?

我正在尝试在remoteview的帮助下在小部件中制作动态listview,因为我想要小部件中的应用程序图标的listview。我想显示来自应用程序明智的所有应用程序的传入通知。我想创建常设通知列表,当用户从ListView中单击应用程序图标时,将显示该特定通知。我正在使用API19获取所有通知并且也成功了,但我不知道如何使用Remoteview在小部件中创建Listview以及使用drawables(Icons)。 最佳答案 您是否搜索过或尝试过其他在小部件中包含ListView的示例?请检查WeatherWidgetdemo在g

android - RemoteViews setLayoutParams?

我想将TextView的高度远程设置为WRAP_CONTENT。我该怎么做,因为没有remoteviews.setLayoutParams(viewId,param)函数?我尝试了remoteviews.setInt.(viewId,"setHeight",-2),但这只是将TextView的高度设置为零...谢谢! 最佳答案 当您创建RemoteViews时,将资源ID传递给将TextView设置为高度并设置为wrap_content的构造函数。请记住,当您发送更新时,实际上是在重绘应用小部件,因此您可以使用布局文件来影响您无法通

android - 无法从小部件发送挂起的 Intent ,SendIntentException

我想使用以下代码从我的小部件发送广播:for(inti=0;i但是,我得到这个错误:E/RemoteViews(18176):Cannotsendpendingintent:E/RemoteViews(18176):android.content.IntentSender$SendIntentExceptionE/RemoteViews(18176):atandroid.app.ContextImpl.startIntentSender(ContextImpl.java:640)E/RemoteViews(18176):atandroid.widget.RemoteViews$SetO

java - Android Widget 上的 RemoteViews setViewVisibility

在我的AppWidgetProvider中,我执行以下操作:@OverridepublicvoidonReceive(Contextctx,Intentintent){finalStringaction=intent.getAction();if(action.equals(NEXTPAGE_ACTION)){AppWidgetManagerappWidgetManager=AppWidgetManager.getInstance(ctx);RemoteViewsrv=newRemoteViews(ctx.getPackageName(),R.layout.widget_layout)

android - 无法禁用 android.widget.Button

我在Android小部件中有一个按钮,声明如下:每次我尝试通过RemoteViews启用或禁用此按钮时,我都会收到错误android.widget.RemoteViews$ActionException:view:android.widget.Buttoncan'tusemethodwithRemoteViews:setEnabled(boolean)我的代码:RemoteViewsremoteViews=newRemoteViews(context.getPackageName(),R.layout.widget);remoteViews.setInt(R.id.newWorkBtn

android - FCM - 如何修复 android.app.RemoteServiceException : Bad notification posted from package Couldn't expand RemoteViews for: StatusBarNotification

我看到数千份与通知相关的崩溃报告,但没有可行的方法来调试或检查Firebase云消息传递中通知的应用代码FatalException:android.app.RemoteServiceException:Badnotificationpostedfrompackagecom.appbootup.ipo.news:Couldn'texpandRemoteViewsfor:StatusBarNotification(pkg=com.appbootup.ipo.newsuser=UserHandle{0}id=2tag=IPO-SMEscore=10:Notification(pri=1co

android - 自动屏幕旋转禁用小部件 RemoteView onClick 事件

我编写的小部件有一个奇怪的错误-在屏幕旋转后小部件停止响应onClick事件。该代码与AppWidgets的Android开发人员文档中的代码完全相同here.我注意到市场上的其他小部件没有这个问题——是否有已知的解决方法?我试过在旋转后点击整个地方,所以我不认为它的onClickPendingIntent在旋转后没有调整大小;它似乎根本不存在。我找不到AppWidgetProvider的onRotation()触发器来在发生旋转时重做监听代码,所以我不确定如何继续...谢谢! 最佳答案 我在Google网上论坛上发表的一篇帖子收到

android - 无法展开 : StatusBarNotification 的 RemoteViews

之前有人问过这个问题,但没有一个答案对我有帮助,因此发布了我的案例。我正在尝试使用布局文件构建自定义通知。但是我收到以下错误:android.app.RemoteServiceException:Badnotificationpostedfrompackagecom.eswaraj.app.eswaraj:Couldn'texpandRemoteViewsfor:StatusBarNotification(pkg=com.eswaraj.app.eswarajuser=UserHandle{0}id=8888tag=nullscore=0:Notification(pri=0conte

android - 用于更新小部件的 AsyncTask - 如何访问 onPostExecute() 中的 TextView ?

以下情况:我有一个appwidget,它从url轮询数据并使用parsedhtml更新widget。在pre-honeycomb设备上,这可以通过service完成,无需使用单独的线程。现在,在ICS上,这已经改变,ASyncThread是必需的。要访问Widget-Updater-Service中的TextViews,我使用RemoteViewsremoteViews=newRemoteViews(getApplicationContext().getPackageName(),R.layout.widget_layout);remoteViews.setTextViewText(R

android - appWidget 仅在 Lollipop 设备的启动器小部件列表中不显示

我有一个适用于android的应用程序,我已经在lollipop之前为它制作了一个appwidget,由于某些原因,该小部件没有出现在lollipop中。然而,它出现在前Lollipop设备中。这是我的代码:AndroidManifest.xml>新闻信息.xmlNewsWidgetProvider.javapublicclassNewsWidgetProviderextendsAppWidgetProvider{privatestaticfinalStringNEXT_NEWS="NEXT_NEWS";privatestaticfinalStringPREVIOUS_NEWS="PR