草庐IT

remoteView

全部标签

android - 无法在 RemoteViews 上设置 ProgressDrawable

我正在尝试调用setProgressDrawable在ProgressBar上在我的RemoteViews但是似乎没有setDrawable(,,)RemoveViews上的方法我试过了setBitmap但是setProgressDrawable需要Drawable不是Bitmap和setInt也不起作用。我想避免为了处理不同颜色的进度条而加载不同的小部件布局xml文件。 最佳答案 没有办法做到这一点。我的解决方案不是创建单独的布局文件,而是创建一个包含具有不同progressDrawable的所有不同ProgressBar的布局文

Android 主屏幕小部件 : RemoteViews setRemoteAdapter(. ..) 方法不适用于 API 11+

所以onUpdate方法调用remoteViews.setRemoteAdapter(id,R.id.listview,intent)为了将适配器应用于小部件中的ListView。小部件的标题中有一个按钮,可以更改ListView显示的数据集(对于假设的电子邮件小部件,想想收件箱、发件箱、已加星标等)。当我单击该按钮时,它会将用户带到一个Activity,允许他们选择要显示的数据集。进行选择后,将运行以下代码:Intentintent=newIntent(this,WidgetReceiver.class);intent.setAction("android.appwidget.act

android - RemoteView addView 不工作

我有一个应用程序小部件,我想将View(TextView等)添加到RemoteView,但它从未显示。代码如下:RemoteViewsviews=newRemoteViews(context.getPackageName(),R.layout.widget_layout);RemoteViewsnewView=newRemoteViews(context.getPackageName(),R.layout.widget_row_layout);newView.setTextViewText(R.id.textUser,"1234");views.addView(views.getLay

android - 如何更改 RemoteViews 中的文本大小

在RemoteViewsService.RemoteViewsFactory下publicRemoteViewsgetViewAt(intposition){finalintitemId=(position%2==0?R.layout.light_widget_item:R.layout.dark_widget_item);RemoteViewsrv=newRemoteViews(mContext.getPackageName(),itemId);rv.setTextViewText(R.id.widget_item,text);//rv.setTextSize(mPrefs.getT

android - GCM 推送通知。已发布错误通知 - 无法扩展 : StatusBarNotification 的 RemoteViews

要求是制作自定义通知,因为android的默认通知只允许图像。所以我研究了如何在扩展时附加自定义UI以进行通知,现成的答案是创建自定义View并传递给通知管理器并允许从API级别16开始。所以我做了一个,这里是我的布局xml代码-文件名:notification_custom_view_new:我在代码中引用它的方式:privateRemoteViewsassignRemote(Bitmapbitmap,Stringtitle,Stringmessage){RemoteViewsexpandedView=newRemoteViews(Application.getInstance().

带有 RemoteViews 的 Android 自定义通知布局

我正在尝试使用此post为我的Android应用程序创建自定义通知,我偶然发现了一个问题,我在过去2小时内试图解决这个问题。只有我的布局的imageview显示,我不知道如何让它按预期工作。我的代码:packagebe.ac.ucl.lfsab1509.cumulus.services;importandroid.app.Notification;importandroid.app.PendingIntent;importandroid.content.Intent;importandroid.support.v4.app.NotificationCompat;importandroi

android - 将 RemoteView 转换为 View

我正在尝试将RemoteViews实例渲染到Canvas上,就像使用常规View一样。我用RemoteViews.apply(context,null)它返回一个FrameLayout,其中所有View都嵌套并正确测量(位置和大小是正确的),但是在返回的View上使用.draw后,它会呈现所有没有值的元素-TextViews为空,AnalogClock被重置在00:00等。有什么想法吗?我迷路了:( 最佳答案 不确定问题是否仍然存在。尽管如此,这是我对RemoveViews的体验。看来您不能只在返回的View上调用draw()。您必

android - 无法展开 RemoteViews

我尝试创建自定义通知,但收到以下异常:FATALEXCEPTION:mainandroid.app.RemoteServiceException:Badnotificationpostedfrompackagecom.my.app:Couldn'texpandRemoteViewsfor:StatusBarNotification(pkg=com.my.appuser=UserHandle{0}id=1tag=nullscore=0:Notification(pri=0contentView=com.my.app/0x7f03001bvibrate=nullsound=nulldefa

android - AppCompat 23.2 在 API<21 上使用 VectorDrawableCompat 和 RemoteViews (AppWidget)

我有一个AppWidget,我想在Lollipop之前的设备上使用VectorDrawables。VectorDrawableCompat不适用于我创建的RemoteView。为了减小我的应用APK大小,我不想为旧API平台添加替代的PNG版本的drawable。我该怎么做? 最佳答案 2017年10月22日更新正如@user924所指出的,现在AppCompatDrawableManager访问仅限于其自己的库。ContextCompat.getDrawable(...)应该可以解决问题。2016年5月9日更新正如@kirill-

android - 从包中发布的错误通知无法展开 RemoteViews

我有问题。有时我的服务会被这个logcat强行关闭:03-2620:44:44.849:E/AndroidRuntime(12080):FATALEXCEPTION:main03-2620:44:44.849:E/AndroidRuntime(12080):android.app.RemoteServiceException:Badnotificationpostedfrompackageby.flipdev.vkspy:Couldn'texpandRemoteViewsfor:StatusBarNotification(pkg=by.flipdev.vkspyid=1tag=null