写一个二维数组类 Array2

摘要: #include #include using namespace std;class Array2{private: int m, n; int** p;public: Array2(int _m,int _n) { m = _m; n = _... 阅读全文
posted @ 2015-10-06 15:35 张茂晨 阅读(692) 评论(0) 推荐(0) 编辑

简单的学生信息处理程序实现

摘要: #define _CRT_SECURE_NO_WARNINGS#include #include #include using namespace std;class student{private : string name; unsigned int age; string I... 阅读全文
posted @ 2015-09-30 12:47 张茂晨 阅读(445) 评论(0) 推荐(0) 编辑

ProgressBar的使用

摘要: 不同风格的进度条属性值:Widget.ProgressBar.Horizontal:水平进度条Widget.ProgressBar.Small:小环形进度条Widget.ProgressBar.Large:大环形进度条Widget.ProgressBar.Inverse:普通大小的环形进度条Widget.ProgressBar.Small.Inverse:小环形进度条Widget.ProgressBar.Large.Inverse:大环形进度条The "inverse" styles provide an inverse color scheme for the spinn 阅读全文
posted @ 2013-12-04 21:39 张茂晨 阅读(182) 评论(0) 推荐(0) 编辑

ListView的使用

摘要: 首先创建一个布局文件作为ListView列表项组件 在界面布局中定义一个ListView 在程序代码中创建一个List集合,List集合的元素是Map List> list=new ArrayList>(); Map map=new HashMap(); map.put("key", "value"); list.add(map);使用SimpleAdapter(Context context, List> data, int resource, String[] from, int[] to)... 阅读全文
posted @ 2013-12-04 10:59 张茂晨 阅读(195) 评论(0) 推荐(0) 编辑

使用Toast显示提示信息框

摘要: 调用makeText()静态方法创建一个Toast Toast.makeText(context, text, duration);使用duration参数修改提示信息的持续时间Toast.LENGTH_SHORTToast.LENGTH_LONG调用show()方法将它显示出来 toast.show(); 阅读全文
posted @ 2013-12-02 01:03 张茂晨 阅读(165) 评论(0) 推荐(0) 编辑

CheckBox的使用

摘要: 首先在XML布局文件中添加CheckBox控件,用于定义复选框 为CheckBox设置监听器 checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { } });使用isChecked判断复选框是否被选中 阅读全文
posted @ 2013-12-02 00:24 张茂晨 阅读(160) 评论(0) 推荐(0) 编辑

RadioButton的使用

摘要: 首先在XML布局文件中添加RadioGroup控件,用于定义一组单选按钮 在RadioGroup中添加RadioButton控件,定义单选按钮 为RadioGroup设置监听器 radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { } });使用c... 阅读全文
posted @ 2013-12-01 23:30 张茂晨 阅读(177) 评论(0) 推荐(0) 编辑

Activity的生命周期

摘要: 创建对话框风格的Activity,要在AndroidManifest.xml文件Activity声明中添加android:theme="@android:style/Theme.Dialog" 阅读全文
posted @ 2013-11-24 22:12 张茂晨 阅读(138) 评论(0) 推荐(0) 编辑

添加选项菜单

摘要: 添加选项菜单要先复写onCreateOptionsMenu方法 public boolean onCreateOptionsMenu(Menu menu) { return super.onCreateOptionsMenu(menu); }使用menu.add添加菜单选项 menu.add(groupId, itemId, order, title);复写onOptionsItemSelected方法来为菜单单击事件编写响应 public boolean onOptionsItemSelected(MenuItem item) { retu... 阅读全文
posted @ 2013-11-18 11:14 张茂晨 阅读(166) 评论(0) 推荐(0) 编辑

使用Intent对象来启动Activity

摘要: 创建Activity要复写(Override)onCreate方法,设置布局文件 protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_other); }在AndroidManifest.xml文件中进行注册 创建Button按钮监听器 class MyButtonListener implements On... 阅读全文
posted @ 2013-11-17 13:19 张茂晨 阅读(332) 评论(0) 推荐(0) 编辑