Android界面开发相关代码.doc_第1页
Android界面开发相关代码.doc_第2页
Android界面开发相关代码.doc_第3页
Android界面开发相关代码.doc_第4页
全文预览已结束

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

一步一步android(9):关于界面控件的学习3【spinner、autocompletetextview. 七、Spinner控件效果如下:使用Spinner控件分为三个步骤:1.修改res/layout/main.xml 添加Spinner控件 2.制作弹出菜单的数据源,该数据源可以来自xml,可以自己写Adapter接口(以后学习)在 res/values修改strings.xml 添加Choose a planet在 res/values下新建array.xml Mercury Venus Earth Mars Jupiter Saturn Uranus Neptune 3.声明并实例化spinner类Spinner sp=(Spinner)this.findViewById(R.id.sp1);ArrayAdapter adapter=ArrayAdapter.createFromResource(this, R.array.planets, android.R.layout.simple_spinner_dropdown_item);sp.setAdapter(adapter);八、AutoCompleteTextView控件效果如下:使用AutoCompleteTextView控件分为三个步骤:1.修改res/layout/main.xml 添加AutoCompleteTextView控件2.定义AutoComplete的字符串 static final String androidwords = new String yao,yuan,yaoyuanhua,yyh,yoganka,yaoyh,yaoandroid,gk14,gk1,g2 ;3.声明并实例化AutoCompleteTextView类 AutoCompleteTextView ac=(AutoCompleteTextView)this.findViewById(R.id.ac1); ArrayAdapter adapter=new ArrayAdapter(this,android.R.layout.simple_dropdown_item_1line,androidwords); ac.setAdapter(adapter);九、NotificationBar控件shownotification(Hello AndroidQQ群697668来新的消息了);private void shownotification(String tab) NotificationManager barmanager=(NotificationManager)getSystemService(this.NOTIFICATION_SERVICE); Notification msg=new android.app.Notification(android.R.drawable.stat_notify_chat,tab,System.currentTimeMillis(); PendingIntent contentIntent=PendingIntent.getActivity(this, 0, new Intent(this,YaoTest.class), PendingIntent.FLAG_ONE_SHOT); msg.setLatestEventInfo(this, 是的,you make it, yes, contentIntent); barmanager.notify(0, msg);为了您的安全,请只打开来源

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论