setAlpha为RemoteViews问题 [英] setAlpha for RemoteViews problem

查看:179
本文介绍了setAlpha为RemoteViews问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在做一个appwidget,而且也对小部件的位图,其中我想改变它的透明度。

I'm making an appwidget, and there's a bitmap on the widget of which I want to change it's transparency.

在我的服务有:

RemoteViews remoteView = new RemoteViews(getApplicationContext().getPackageName(), R.layout.myWidget);

remoteView.setInt(R.id.widgetPNG, "setAlpha", 50);

不过,这是行不通的。仿真器显示问题加载插件在主屏幕上。 我是pretty的肯定一切是好的COS时,我改了行,以改变它的imageResource它完美运行: remoteView.setInt(R.id.widgetPNG,setImageResource,R.drawable。 anotherPNG)。

But it doesn't work. The emulator shows "Problem loading widget" on the home screen. I'm pretty sure everything else is fine cos when i changed the line to change it's imageResource it runs perfectly: remoteView.setInt(R.id.widgetPNG, "setImageResource", R.drawable.anotherPNG).

谁能帮助我?我一直坚持这一个星期......

Can anyone help me? I've been stuck with this for a week...

推荐答案

上午冒牌货,你只能叫 SETINT()和API的朋友这是标有 @RemotableViewMethod 标注在Android源$ C ​​$ C(<一href="http://google.com/$c$csearch/p?hl=en#uX1GffpyOZk/core/java/android/view/View.java&q=RemotableViewMethod&d=4&l=7375">example).怕 setAlpha()是不是其中之一。

Am fraid you can only call setInt() and friends on APIs which are marked with the @RemotableViewMethod annotation in the Android source code (example). Afraid setAlpha() is not one of them.

也许可以有两个背景图像,一个透明的和非透明的...

Maybe you could have two background images, a transparent one and a non-transparent one...

这篇关于setAlpha为RemoteViews问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆