摘要: package src.com;import java.util.ArrayList;import java.util.HashMap;import java.util.List;import java.util.Map;import android.app.Activity;import android.app.ExpandableListActivity;import android.os.Bundle;import android.widget.ExpandableListAdapter;import android.widget.SimpleExpandableListAdapter; 阅读全文
posted @ 2012-03-27 16:53 幻星宇 阅读(167) 评论(0) 推荐(0) 编辑
摘要: package src.com;import java.util.ArrayList;import java.util.HashMap;import java.util.List;import java.util.Map;import android.app.Activity;import android.app.ExpandableListActivity;import android.os.Bundle;import android.widget.ExpandableListAdapter;import android.widget.SimpleExpandableListAdapter; 阅读全文
posted @ 2012-03-27 16:52 幻星宇 阅读(252) 评论(0) 推荐(0) 编辑
摘要: 在Android的app包中,有这么一个类,这个类继承自Activity,它叫ExpandableListActivity。顾名思义,从它的名字 可以看出该类是一种可扩展性的列表List,我们这里理解成可伸缩的列表,也就是通过继承ExpandableListActivity 可以实现列表的可展开/收缩的功能。 本文我们主要介绍这种列表的显示是如何实现的,在ListActivity的使用中,我们知道一旦继承了ListActivity,该类就意味这具备了 List的功能,同样的,我们将一个类继承了ExpandableListActivity,就可以直接调用该类本身的ExpandableList对 阅读全文
posted @ 2012-03-27 16:51 幻星宇 阅读(282) 评论(0) 推荐(0) 编辑
摘要: package src.com;import android.app.Activity;import android.content.Context;import android.graphics.Canvas;import android.graphics.Color;import android.graphics.Paint;import android.graphics.RectF;import android.os.Bundle;import android.view.View;public class DrawActivity extends Activity { /** Calle 阅读全文
posted @ 2012-03-27 16:11 幻星宇 阅读(172) 评论(0) 推荐(0) 编辑
摘要: Android提供了Invalidate方法实现界面刷新,但是Invalidate不能直接在线程中调用,因为他是违背了单线程模型:Android UI操作并不是线程安全的,并且这些操作必须在UI线程中调用。invalidate()是用来刷新View的,必须是在UI线程中进行工作。比如在修改某个view的显示时,调用invalidate()才能看到重新绘制的界面。invalidate()的调用是把之前的旧的view从主UI线程队列中pop掉。 一个Android 程序默认情况下也只有一个进程,但一个进程下却可以有许多个线程。在这么多线程当中,把主要是负责控制UI界面的显示、更新和控件交互的线程称 阅读全文
posted @ 2012-03-27 16:10 幻星宇 阅读(189) 评论(0) 推荐(0) 编辑
摘要: /***Paint类介绍**Paint即画笔,在绘图过程中起到了极其重要的作用,画笔主要保存了颜色,*样式等绘制信息,指定了如何绘制文本和图形,画笔对象有很多设置方法,*大体上可以分为两类,一类与图形绘制相关,一类与文本绘制相关。**1.图形绘制*setARGB(inta,intr,intg,intb);*设置绘制的颜色,a代表透明度,r,g,b代表颜色值。**setAlpha(inta);*设置绘制图形的透明度。**setColor(intcolor);*设置绘制的颜色,使用颜色值来表示,该颜色值包括透明度和RGB颜色。**setAntiAlias(booleanaa);*设置是否使用抗锯齿 阅读全文
posted @ 2012-03-27 15:56 幻星宇 阅读(1208) 评论(0) 推荐(0) 编辑
摘要: // pointer_func.cpp : Defines the entry point for the console application.//#include "stdafx.h"void ptrswap(int *&v1, int *&v2){ int *tmp = v2; v2 = v1; v1 = tmp;}int main(int argc, char* argv[]){ int i = 10; int j = 20; int *pi = &i; int *pj = &j; cout << "Befor 阅读全文
posted @ 2012-03-27 15:08 幻星宇 阅读(231) 评论(0) 推荐(0) 编辑
摘要: #include "stdafx.h"int main(int argc, char* argv[]){ //string s("hello world"); string s = "hello world"; string *p = &s; *p = "goodbye";//此时字符串s的值也变化了 string *sp = &s; sp = p; *sp = "new another world";//都指向了同一内存地址 cout << s << e 阅读全文
posted @ 2012-03-27 13:56 幻星宇 阅读(137) 评论(0) 推荐(0) 编辑
摘要: // vector.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include <vector>int main(int argc, char* argv[]){ /*string word; vector<string> text; int i = 0; while( cin>>word ){ text.push_back(word); cout << text[i] << endl; i++; } 阅读全文
posted @ 2012-03-27 11:44 幻星宇 阅读(194) 评论(0) 推荐(0) 编辑