安卓:查看由ID? (从窗口小部件提供商) [英] Android: View by id? (from Widget Provider)
本文介绍了安卓:查看由ID? (从窗口小部件提供商)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我知道只有一种方式来获得由ID的看法:
I know only one way to get a view by id:
getViewById(R.drawable.imageButton)
但我怎么如果我没有一个活动(开发窗件应用程序),以获得此的ImageButton
But how am I supposed to get this imageButton if i don't have an activity (developing a widget application)
我能得到一个上下文。我想这是足以让视图 - 背景中只包含一个小部件是不是?如果没有 - 那么如何让每个插件的意见
I am able to get a context. I suppose it is enough to get the view - context contains only one widget isn't it? And if not - then how to get each widget views ?
推荐答案
有关窗口小部件,你有 RemoteViews ,例如:
For Widgets you have to work with RemoteViews, for example
RemoteViews updateViews = new RemoteViews(this.getPackageName(), R.layout.widget);
Here you can find a tutorial of how to use them
这篇关于安卓:查看由ID? (从窗口小部件提供商)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文