说三道四技术文摘-感悟人生的经典句子
说三道四 > 文档快照

RemoteViews - Android Widget开发入门

HTML文档下载 WORD文档下载 PDF文档下载
RemoteViews类描述了一个View对象能够显示在其他进程中,可以融合从一个 layout资源文件实现布局。

 

作者:Android开发网
   RemoteViews类描述了一个View对象能够显示在其他进程中,可以融合从一个 layout资源文件实现布局。虽然该类在android.widget.RemoteViews而不是appWidget下面但在Android Widgets开发中会经常用到它,主要是可以跨进程调用(appWidget由一个服务宿主来统一运行的)。
   如何实例化一个RemoteViews
构造方法

 

作者:Android开发网

 

   RemoteViews类描述了一个View对象能够显示在其他进程中,可以融合从一个 layout资源文件实现布局。虽然该类在android.widget.RemoteViews而不是appWidget下面但在Android Widgets开发中会经常用到它,主要是可以跨进程调用(appWidget由一个服务宿主来统一运行的)。

 

   如何实例化一个RemoteViews

 

构造方法

 

RemoteViews(String packageName, int layoutId)

创建一个新的RemoteViews 对象将显示 views包含指定一个layout资源.

 

RemoteViews(Parcel parcel)
读取RemoteViews对象从一个parcel中.
   首先给大家一段例子简单说明下构造和如何使用
RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.appwidget_provider);views.setTextViewText(R.id.appwidget_text, "okbase.net欢迎您");  appWidgetManager.updateAppWidget(appWidgetId, views);
详细的 该类的公共方法列表,下面的viewId为layout文件中的id定义,常用的方法已经翻译成中文描述。
Public Methods
View apply(Context context, ViewGroup parent)
Inflates the view hierarchy represented by this object and applies all of the actions.
int describeContents()
Describe the kinds of special objects contained in this Parcelable's marshalled representation.
int getLayoutId()
String getPackage()
boolean onLoadClass(Class clazz)
Hook to allow clients of the LayoutInflater to restrict the set of Views that are allowed to be inflated.
void reapply(Context context, View v)
Applies all of the actions to the provided view.
void setBitmap(int viewId, String methodName, Bitmap value)
Call a method taking one Bitmap on a view in the layout for this RemoteViews.
void setBoolean(int viewId, String methodName, boolean value)
Call a method taking one boolean on a view in the layout for this RemoteViews.
void setByte(int viewId, String methodName, byte value)
Call a method taking one byte on a view in the layout for this RemoteViews.
void setChar(int viewId, String methodName, char value)
Call a method taking one char on a view in the layout for this RemoteViews.
void setCharSequence(int viewId, String methodName, CharSequence value)
Call a method taking one CharSequence on a view in the layout for this RemoteViews.
void setChronometer(int viewId, long base, String format, boolean started)
Equivalent to calling Chronometer.setBase, Chronometer.setFormat, and Chronometer.start() or Chronometer.stop().
void setDouble(int viewId, String methodName, double value)
Call a method taking one double on a view in the layout for this RemoteViews.
void setFloat(int viewId, String methodName, float value)
Call a method taking one float on a view in the layout for this RemoteViews.
void setImageViewBitmap(int viewId, Bitmap bitmap)
等同于调用ImageView.setImageBitmap方法,从Bitmap对象中设置一个图片
void setImageViewResource(int viewId, int srcId)
等同于调用ImageView.setImageResource,从一个资源中设置图片
void setImageViewUri(int viewId, Uri uri)
等同于调用ImageView.setImageURI,从URI中设置图像
void setInt(int viewId, String methodName, int value)
Call a method taking one int on a view in the layout for this RemoteViews.
void setLong(int viewId, String methodName, long value)
Call a method taking one long on a view in the layout for this RemoteViews.
void setOnClickPendingIntent(int viewId, PendingIntent pendingIntent)
Equivalent to calling setOnClickListener(android.view.View.OnClickListener) to launch the provided PendingIntent.
void setProgressBar(int viewId, int max, int progress, boolean indeterminate)
等同于调用ProgressBar.setMax, ProgressBar.setProgress, and ProgressBar.如果indeterminate为true则进度条的最大和最小进度将会忽略
void setShort(int viewId, String methodName, short value)
Call a method taking one short on a view in the layout for this RemoteViews.
void setString(int viewId, String methodName, String value)
Call a method taking one String on a view in the layout for this RemoteViews.
void setTextColor(int viewId, int color)
等同于setTextColor(int).,设置文本的颜色
void setTextViewText(int viewId, CharSequence text)
等同于TextView.setText,设置文本内容
void setUri(int viewId, String methodName, Uri value)
Call a method taking one Uri on a view in the layout for this RemoteViews.
void setViewVisibility(int viewId, int visibility)
等同于调用View.setVisibility,设置该ID控件的可见性
void writeToParcel(Parcel dest, int flags)
Flatten this object in to a Parcel.

 

怎样建立简单的任务栏应用程序-Delphi资料 增强DelphiTStatusBar控制 制作Delphi的竖排标签 自适应表单的实现-Delphi资料 COM/DCOM的区别与联系-Delphi资料 CoolBar上控件的排列顺序-Delphi资料 Delphi 4 WebBroker Delphi 中自做动态显示的控件 Delphi3的DBGrid中的下拉列表和查找字段编程方法 DELPHI常见问题 Delphi的竖排标签 DELPHI构件制作方法 DELPHI控件Tweblabel的编制 DELPHI中MEMO组件的光标定位 Delphi中RichEdit的奥妙 Delphi中TApplication类 Delphi中日期时间输入的简洁方法 delphi中怎么调用interbase数据库? Memo的Undo功能-Delphi资料 RECT在Delphi中的灵活使用 StringGrid制作只读列-Delphi资料 TADOQuery下主明细表其属性关系如何设置,如何保存主表和明细表?-Delphi资料 TBatchMove用法-Delphi资料 TMemo的真正插入字符-Delphi资料 TREEVIEW的使用-Delphi资料 TreeView在电信综合统计管理系统中的应用-Delphi资料 VB6.0动态加载ActiveX控件漫谈-Delphi资料 捕捉来自 Thread 的异常-Delphi资料 定制Speedbar-Delphi资料 动态产生构件并相应事件-Delphi资料 对Borland可视部件的一处改进-Delphi资料 大家好。 我是新人。。。。。。。 关于用vc操作word中表格的问题 我的机子运行了几个用bde连接数据库的程序,在delphi里就打开不了src了出现以下错误! 求大家一个问题.我已经快疯了?我在等待ing 请问如何用delphi编写一个录音的com组件,在ASP中调用,详细些! 不知道自己到底喜不喜欢女朋友,纳闷.......... 急问!!! 很简单的问题,但是很急,解决了就给分!! 根据一些来历不明的消息说,微软将在2008年停止对 VB.NET 进行技术支持。是真的吗??? 怎样实现倒退和快进,用mediaplay组件播放影片,想在影片结束时自动调用某个过程,这个影片结束的事件是什么? 怪:DataGrid中选择一行后此行不能编辑! 有谁用过工商银行的国际借记卡了吗? 如何将反馈表中的若干表单内容发送到指定的邮箱并同时抄送到另一信箱? 使用游标时出现 -1002 的错误如何解决? 数据的初始化问题。 [求助] 如何用DirectX显示YUV格式的图像 我在安装Red Hat8时说一个文件坏了,但我有源代码,怎样编译成成哪个文件。 桌面内容不见了! 怎么获得当前目录 快救命啊高手们、菜鸟兄弟们,偶遇到sql语句问题啦,怎么对数据库插入数据啊100分给你 一个很白痴的问题,不过我实在搞不定,关于dbGrid的 一个关于数组基本使用方法的问题 请问如何把数据写到用OleContainer控件建立的WordApplication文档里面和如何从里面读取数据? 重回pb论坛,庆祝一下! [初级]请问如何在WebServer连接DBServer的Access资料库? WIN2000的MSDOS下无法输汉字 win2000p的老问题了,关于虚拟内存,页面文件 如何删除sql的日志文件!! 快救命啊高手们、菜鸟兄弟们,偶遇到sql语句问题啦,怎么对数据库插入数据啊100分给你 datagrid的问题,请大家进去看看,帮帮忙!在线等待 各位高手 用什么方法可以拖慢我的机器 在delphi中如何动态建立oracle的存储过程和触发器? 刷新父窗体的问题 请问:float数据的转换(见文章) 高手,救命啊!!在線等! 急问:win2000 的sp3可以打在win2000高级服务器版上么? 急死人了!!!!! TMNHttp组件的post方法的使用问题? 快救命啊高手们、菜鸟兄弟们,偶遇到sql语句问题啦,怎么对数据库插入数据啊100分给你 怎么样在bcb5里做一个类似于资源管理器的浏览界面? 请教数据类型转换的完整答案 马上结帖! oracle8.1.7支持全文检索吗? CMap<int, int, CString, CString> m_cMap 如何方便地找到函数的定义和包 为什么IdPOP3一用Retrieve方法就出错???? 在程序中无何派断本地机是否装了OFFICE中的word,并且如何获得它的路径(.exe的完全路径,我要调用这个程序) 请教资源文件问题 insert 语句~总出错,从一个表中查出来的数据插入到另一个表中~大家看看 String的长度最大有多大啊? 急切盼望 He lived in London for 3 months,during_time he learned some EnglishA.which B.that 为什么不是B?which不是可以指代that time 用它的话岂不是两个time? what time is the party begin ____ _ ____ ——-- 找出错误并改正 There is going to be a ________ ________(时装表演会) this evening.She __ want to be a basketball __ 她不想成为一名篮球队 which country is the larger population ,India or China?|这个句子正确吗 is,it's,the,in,at,evening,time,o'clock,begin,begins,six,what,party,连词成句the,it,does,the,in,at,evening,time,o'clock,begin,begins,six,what,party, is,it's,the,your,on,of,when,May,birthday,second She --is sitting--near the window对划线提问 分析该句he lived in the london是把lived in看作整体做谓语,后跟london做宾语.还是把in the london看成状语修饰动词lived Is it time___(begin) the party she is sitting near the windon.对near the windon提问 More than __________homeless children couldn't go to school after the earthquake.A.seven thousands B.seven thousand C.seven thousand of D.thousands of she arrived in newyork in1896,,some time later,he became a writer.没说清楚。前两个逗号之间是一条横线,选择填空:A.when B.where C.that D.which the table is near the window对划线部分提问,near the window.怎么提问 my family (stay) in London for some time Soon he got to London,( )some time later he started his businessA.when B.where C .that d.which 我选D,为什么答案是B呢 Some people understand me?3Q Fires may do more damage than the earthquake的意思? He reached london in1990,_____,some time later,he became a famous actor.答案是where为撒...He reached london in1990,_____,some time later,he became a famous actor.答案是where为撒不能是when? Some people said they want to three children,one of each.what are they respectively?if the answer is boy and girl,who is the rest one? Look!Some__(child)are playing football on the ground. When he was in London,he lived in a l___ family. deemed it was time for a change 这句英语的中文是什么?很急, I Were playing some ridiculousariati on football的中文意思I were playing some ridiculous variation on football 有句歌词是girl's time to let you know 什么英文歌,旋律挺happy的 是男声唱的,貌似是一个乐队来着.求求求求求啊! 求change of time 的歌词意思? There are some children who _____(play) football on the playground是Plays? What time does the first class begin的意思是什么 A Time For Us 歌词 I were playing some ridiculous variation on football的中文意思 What time does the( )(meet)begin? time for miracles歌词 I see some children playing football.对画线部分提问 _______________________I see some children playing football.对画线部分提问_______________________l'm writing a postcard.对画线部分提问_____________We write on the left on a post what time does the shcool begin?为什么用does而不用is? "Some students do homework three or four times a week"中为什么要有"or"而不是"and" 新加坡华人占多少? What time does the class begin?=( )( )does the class begin? 英文:I have you is my biggest happiness in this life! the play may begin at any moment和the play will begin at any moment的区别.may have begun at any moment是过去的吧 会议几点钟开始 what time does the meeting _ I'm sure that I can finish the work的同义句I'm sure__ __the work put off tyrn off break off take off We take a bike to the zoo.同义句怎么改 There were only three _____them.A.million B.millions 0f 那个翻译软件 可以翻译 航空类词汇譬如说 飞机安定面.升降舵,如果有初级教练机的维修手册(中文)的更好谢谢!DA40最优 take a bike for work?骑单车去上班 它给我弹出了一个 Could not launch game Only one instance of this game can be run at a time 英语翻译直接说成谐音 比如说 0——度 1——幺 can you _______what time the meeting stars?Afind Bfind out Clook for Dwork out sometime sometimes some time 的区别 英语翻译Air operational status requirements pageChanges to same fare marketing type are not allowedGhost ConfirmedMerged ConfirmedRegister and ReplaceConfirming WaitlistHolding Need RequestIf Not Holding NeedPassive NeedWith JavaScript switched o the time has come to change our way of life啥意思 in a world like this 的中文翻译 collective在航空术语里怎么翻译 请问,on one’s bike等不等于take a bike? Sorry Ishould not have brought you in this world.This dirty world是什么意思 After the big earthquake, the house remained____.It was amazing.A.safe b.safetyC.dangerous D.dangerously要说明理由 There is going to have a concert this evening.这里的going to的意思? 英格兰的巨石阵到底是怎么回事?巨石阵是做什么用的?又是怎样建立起来的?科学家们有什么不同的看法吗? which province has the most population in china? What time (do)the party begin?. 先入为主!ten minutes' walk的提问为啥是How far is it from your home to school?而不是How long does it take you to get to school?
备案号:鲁ICP备13029499号-2 说三道四 www.s3d4.cn 说三道四技术文摘