2011年3月15日
摘要: handler机制在很多时候都用来跟新UI,这里把ProgressBar与handler混搭,重点来看handler的使用。public class mProgressBarActivity extends Activity implements OnClickListener{ private TextView mTextView01; private Button mButton01; private ProgressBar mProgressBar01; public int intCounter=0; /* 自定义Handler信息代码,用以作为识别事件处理 */ protected 阅读全文
posted @ 2011-03-15 18:10 可乐boyupeng 阅读(346) 评论(0) 推荐(0) 编辑
摘要: 一般的对话框只有一条message,怎么让对话框列出很多选项,并且可以选中其中的一个呢?那就要在对话框中加入数组,使之具有选择功能。现在string中加入数组,代码如下:<?xml version="1.0" encoding="utf-8"?><resources> <string name="str_ok">确认</string> <array name="items_irdc_dialog"> <item>你是帅哥</item> 阅读全文
posted @ 2011-03-15 16:15 可乐boyupeng 阅读(208) 评论(0) 推荐(0) 编辑
摘要: 在后台程序运行时,经常需要弹出进度条,来减少用户的等待感,下面用线程等待3秒来模仿后天程序的运行,简单代码如下:public class ShowProgressBarActivity extends Activity{ private Button mButton1; public ProgressDialog myProgressDialog = null; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.o 阅读全文
posted @ 2011-03-15 15:31 可乐boyupeng 阅读(524) 评论(0) 推荐(0) 编辑
摘要: 有一种类似苹果手机的拖动图片的控件,叫做Gallery。实现其需要用到BaseAdapter适配器来传递图片数据,简单的实现代码如下:public class GalleryDemo extends Activity{ private TextView mTextView01; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView 阅读全文
posted @ 2011-03-15 15:04 可乐boyupeng 阅读(244) 评论(0) 推荐(0) 编辑
摘要: 如果要将数据从一个activity传递到另一个activity,就需要利用bundle的数据封装能力。首先在PutBundleActivity中将数据放入bundle,代码如下:public class PutBundleActivity extends Activity{ /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R 阅读全文
posted @ 2011-03-15 13:48 可乐boyupeng 阅读(261) 评论(0) 推荐(0) 编辑