UI
Layout  
  Common Layout
  Adapter Layout
InputControls
  Button
  TextFields
  CheckedBox  RadioButton
  SeekBar ProgressBar  RatingBar
InputEvents
  UI Commons
  ActionBar
  Dialog
  Notification
  Toast
App Resotuces
  drawable
  values
  layout
  menu
  xml`
Animation  Animator
  特效
Drawable  Canvas
 
消息模型API方法总结
  Message
   obj what arg1 arg2 target callable
()
()
  MessageQueue
  Looper
()
()
()
()
()
  Handler
   sendMessage
   sendEmptyMessage
   
 
反射:
drawable中的信息  可以采用 反射 先得到类对象 再通过类对象获得文件的名字 通过判定文件名的结束为.png
f.getInt(类对象) 得到图片的 id  添加到list集合  再通过 adapter 将图片显示到 view 中
  Class<?> cla=MainActivity.class
 案例:
为 searchView;
   Class<?> c=sv.getClass();
通过值 得到值对应的属性
因为此属性不可见  所以要进行此操作
得到 此对象的 这个属性的对象 通过此对象来 控制 属性的值 
类 AutoCompleteTextView  通过继承关系找到
 
AutoCompleteTextView
acltv.setThreshold(1);
acltv.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, new String[]{"aa","ab","aa1"}));
 
 EditText
   android:ems="10"
   android:inputType="text"
   android:imeOptions="actionSearch"
   android:imeOptions="actionSend"
   监听:
实现接口 重写方法
()
canvas.drawLine(0, getHeight()-2, getWidth(), getHeight()-2, p);  自定义view
 
searchView
sv.setOnQueryTextListener();实现接口 重写方法
     sv.onActionViewExpanded()   
(String newText)   数据发生改变时 就执行  也就是说 一直在监听的状态  参数为当前获得的 输入框中的输入的内容
        检索采用此方法  比较 的语句为 :
().filter(NewText);
()      当点击 确定是 才调用 才执行
   另一种形式:
       int i=getResources().getIdentifier("android:id/search_plate", null, null);
LinearLayout ll=(LinearLayout) sv.findViewById(i);
ll.setBackgroundResource(R.drawable.sss);
 
TextView的监听
();实现接口 重写方法  
()
       event.getAction()==MotionEvent.ACTION_DOWN
 
ViewStub 
   延迟加载
vs.inflate()方法 开启vs
的id
必须要设定的 但是id值随意
调用布局文件 布局文件中添加的是 要加载的 文件例如progressBar
 
ProgressBar
ProgressBar加载到布局中 通过 View 展现 将 此view 加载到 ListView 的 最顶端 或最低端
      View a=View.inflate(this, R.layout.shuaxin, null);
      getListView().addFooterView(a);
      getListView().addHeaderView(a);
 
ListView
   android:divider="#ff999999"
   android:dividerHeight="2dp"
   android:listSelector="@drawable/cai"
()实现接口 重写方法
(AdapterView<?> arg0, View arg1, int arg2, long arg3)
中存放的item中的list<String>的数据的类型 即为返回值类型  
(String)arg0.getItemAtPosition(arg2);
 
ListActivity 中的ListView
setListAdapter()  来关联 adapter   其中有自己的 listview 所以自己不必定义 
getListView() 获得 ListView 对象 
   直接重写
(ListView l,
View v,        //v指向item view
int position, long id)方法  设置ListView的 点击事件
(position);
    会直接显示到 布局文件中
设置选择模式为 多选
 
 
SimpleAdapter
   最烦人了  参数要求麻烦
new SimpleAdapter(this,
list,         //必须是Map《String , ?》 类型的list的集合   可以通过 解析xml获得
R.layout.buju,     //每个item 的布局
new String[]{"title","content","image"},  每个map对象中均存在三组数据  
new int[]{.textView1,.textView2,.imageView1});  将获得的对应的数据 存放到对应的 item 中的 相应的idshang  
 
Adapter
view时  若存在 imageView  可以采用 
将图片添加到 布局中
 
ArrayAdapter
textView 和 Button 时 
arrayadapter  
    在创建时 创建 新类的 类的对象  
list 先给 TextView 赋值  然后 在新类中重写getView 方法  继续使用 父类的  方法 在父类的getView 方法的基础上 通过id 获得 Button
button 添加点击事件  删除对应的信息啦
button 此个item 的 position进行绑定 或者 在方法中 定义一个新的 变量  给其赋值为 position
final 类型的  在匿名内部类中才可以进行访问 
(positon);
listView;   NotifyDateSetChanged();
 
联系人列表的右侧的 26个英文字母的 
ListView 背景设置为 点击背景 
未设置的 drawable引用 shap  圆 设置了 半径和颜色
26个英文字母 添加到 adapter 对应的 item中   采用下列代码可以直接将 String——array 中的 name为 nav   的 中的item中的数据读出  布局采用haha
      ArrayAdapter.createFromResource(this, R.array.nav,R.layout.haha);
ListView的点击事件 当点击时 得到对应的item中的 值 将值传给  联系人列表的 排序方法
item中的textView 其他的都隐藏
adapter中 建立 item时  比较 该item中的用户名字 的首字母 是否和 以前的item中的名字的首字母相同的  
item中的 TextView 显示出来  否则就将 item中的 TextView 隐藏并且还不占用空间 )
item 的 position  
zhegeposition 对应的 item 展示到 联系人 列表的最顶端  采用的方法为 :
().setSelectionFromTop(positon,30);据顶端的距离为 30dp
name的 首字母  转换为大写   
   vh.tt1.setText(String.valueOf(u.getN().toUpperCase().charAt(0)));
显示
不占用空间 隐藏
不用分隔线 导航栏
 
ExpandableListView
   设置 组展开
     explv.expandGroup(0);
()  ;adapter 必须继承 BaseExpandableListAdapter  
   group[2]
有几个组  child中 就应该有几个对应的  一维数组
id是否是稳定 相同的id假如指向的元素永远是相同的那么就是稳定
@Override
public boolean hasStableIds() {
return false;
 }
true表示可以
@Override
public boolean isChildSelectable(int groupPosition, int childPosition) {
return true;
}
   重写方法
public boolean onChildClick()  设置 组中元素 即 child 的点击事件
 
Spinner
arrayadapter 中 字符串数组的 第一个值
   得到选框中得值
   s.getSelectedItem()
 
Toast
context 可以是:getApplicationContext();
 
ViewPager
()创建 item  将图片添加到 布局
() 移除文件
()得到当前布局的 宽 高
重绘 会调用 onDraw()方法;
事件监听  实现接口 重写相应方法
()  页面开始改变时执行一次
(偏移量), int arg2)   //一直在执行
()  页面改变完成后 执行一次
 
attars
   TypedArray ta=context.obtainStyledAttributes(attrs,R.styleable.Caicai);
   r=ta.getInteger(R.styleable.Caicai_r, 5);
   yeshu=ta.getInteger(R.styleable.Caicai_yeshu, 1);
   color=ta.getColor(R.styleable.Caicai_color, Color.parseColor("#ff00ff00"));
 
Paint 
消除锯齿
设置颜色
设置 画的圆的样式 空心圆 实心圆 还是 圆环
 
View v  (补LineraLayout)
    LinearLayout.LayoutParams llp=new LinearLayout.LayoutParams(10, 10);
    llp.leftMargin=5;
    v.setLayoutParams(llp);
Java 

    v.setBackgroundResource(R.drawable.huadong);
    v.setEnabled(false);   
设置 此view 为 false 这是与  drawable.huadong  有关的   huadong中的 item 中 state_enabled为
时  和 为 true 是 背景色不同  用于显示不同的 颜色
(v)      //可以添加 View 
(LinearLayout).getChildAt(0).setEnabled(true);   可以得到 第一个 的view 并进行相应的设置
 
RadioGroup、RadioButton 
   单选框
清空选项
   int id=rg.getCheckedRadioButtonId();
   RadioButton rb=(RadioButton) rg.findViewById(id);
   CharSequence s=rb.getText();
 
SeekBar
   事件监听
   sb.setOnSeekBarChangeListener(this);
   实现接口 重写方法:
()   //一直在执行
() //开始的时候执行
()  //结束的时候执行
最大为100
当前进度为 10
缓冲到 90
滑动块 为 小矩形(自定义的)
(设置的背景色 不会的话去参考官方代码 自己去抄 名字就为 前边的名字 找不到 就去屎吧)
        
RatingBar  
   评价条:    
有5颗星
当前 满了 3颗
半颗 半颗的增加
是否允许用户点击
 
ImageSwitcher
makeView()  创建 ImageView 
iv的 大小  iv.setLayoutParams(new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); 
图片显示
设置工厂
设置动画
   点击事件  监听
()  实现接口 重写方法
()
            event.getAction()==MotionEvent.ACTION_DOWN
            event.getAction()==MotionEvent.ACTION_UP
x2=event.getX()  
            当两次的坐标相差多少时  来判定下次展示的图片
 
Menu
onCreateOptionsMenu()创建菜单:
onOptionsItemSelected(MenuItem item)  监听
得到 菜单中点击的 item 的id
       Intent i=new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
开启 菜单 相机 
捕获照片 没讲
       Intent i2=new Intent(Intent.ACTION_CALL);
       i2.setData(Uri.parse("tel:110"));
打电话
菜单项       ID  顺序     不显示    有空间就显示  总是     收起collapse    标题-->
    <item
        android:id="@+id/action_settings"
        android:orderInCategory="100"
        android:showAsAction="always"
彩儿"
        android:icon="@android:drawable/ic_menu_help"/>
 子菜单 
    <item
        android:id="@+id/action_settings1"
        android:orderInCategory="101"
        android:showAsAction="always"
        android:title="caicai"
        android:icon="@android:drawable/star_big_off">
        <menu >
            <item android:id="@+id/m1"
                android:orderInCategory="201"
                android:showAsAction="never"
笨"
                android:icon="@android:drawable/stat_notify_call_mute"/>
            <item android:id="@+id/m2"
                android:orderInCategory="202"
                android:showAsAction="never"
大笨蛋"
                android:icon="@android:drawable/stat_notify_chat"/>
        </menu>
    </item>
代码:
哈哈");
    mi1.setIcon(android.R.drawable.stat_notify_chat);
    mi1.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
创建含有子菜单的菜单项
    MenuItem mi111=mi11.add(2, 202, 221, "chuxian");
    MenuItem mi112=mi11.add(2, 203, 222, "chuxian");
java 代码 写的 子菜单在 菜单栏中不显示
 
上下文菜单:
将 菜单 和 ListView 进行绑定吧     注册    
   重写方法:
()//基于上下文的长按菜单   当采用xml加载时  抄一下系统默认的调用菜单的格式就好了 加载上菜单
list的索引值 即为 id值 可通过 :
            AdapterContextMenuInfo acm=(AdapterContextMenuInfo) getMenuInfo();
            final int i=acm.position;
(MenuItem item)菜单响应事件
         AdapterContextMenuInfo acm=(AdapterContextMenuInfo) item.getMenuInfo();
获得 选中的菜单的 id  通过id 去修改文件  switch();
得到的是 长按的列表的id adapterContextMenuInfo 中 封装的是 长按列表的索引信息
      aad.notifyDataSetChanged();
              文件删除后刷新
  
PopupMenu
    自己去想吧
popup.setOnMenuItemClickListener();重写方法
 
ActionBar
   ab=getActionBar();
   ab.setDisplayHomeAsUpEnabled(true);
   ab.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
菜菜").setTabListener(this));
的监听事件:重写的方法:
();
();   vp.setCurrentItem(tab.getPosition());   tab 和 vp 的联动   ab.setSelectedNavigationItem(arg0);
();
onOptionsItemSelected(MenuItem item){   item.getItemId()==android..home    finish(); }
              系统给出的后退
 
onBackPressed();返回 方法
 
Notification
   Intent i=new Intent(this,NotiMainActivity.class);
(请求吗,随便写个值就好了!  设置延迟意图  当点击时 才执行 ),
                      i, PendingIntent.FLAG_UPDATE_CURRENT);
   RemoteViews v=new RemoteViews(getPackageName(), R.layout.ca);
v.setTextViewText(.textView1, "倩倩");
v.setTextViewText(.textView2, "youyou");
Notification n=new NotificationCompat.Builder(this)
笨蛋").setContentTitle("caier")
音乐")
                          .setContent(v).build();
   n.flags=Notification.FLAG_AUTO_CANCEL;
   ntfm.notify(1, n);
在没有销毁的  另外两大事件
 
 
图片压缩:
    Options opts=new Options();
借助option对象封装选项信息
    Options opts=new Options();
设置Options对象的inJustDecodeBounds值为true
当此属性的值为true时,表示只读取图片的边界信息
    opts.inJustDecodeBounds=true;
读取图片边界信息,并将其信息封装到options对象
    BitmapFactory.decodeFile(
    pic.getPath(),opts);
获得图片边界信息
    int oHeight=opts.outHeight;
    int oWidth=opts.outWidth;
    Log.i("TAG", "oHeight="+oHeight);
    Log.i("TAG", "oWidth="+oWidth);
计算并设置压缩比例
获得window窗口显示信息,
并将其封装到DisplayMetrics对象中
    DisplayMetrics dm=new DisplayMetrics();
    getWindowManager()
    .getDefaultDisplay()
    .getMetrics(dm);
    int hPix=dm.heightPixels;
    int wPix=dm.widthPixels;
            int x=oWidth/wPix;
    int y=oHeight/hPix;
            opts.inSampleSize=y;
设置Options对象的inJustDecodeBounds值为false
    opts.inJustDecodeBounds=false;
读取文件内容
    Bitmap bitMap=BitmapFactory.decodeFile(
    pic.getPath(),opts);
        return bitMap;
    图片缓存
    File cache=//
    getExternalCacheDir();//context
    File newPic=new File(cache,"cacheql.JPG");
    OutputStream out=null;
    try{
    out=new FileOutputStream(newPic);
图片格式 压缩比例  写到哪儿
    out.close();
    }catch(Exception e){e.printStackTrace();}
 
 
this.getclass().getSimleName();
this.getclass().getName;           获得 包名 
 
SharedPreferences 
   spf=getSharedPreferences("caicai", MODE_PRIVATE);
   Editor e=spf.edit();
   e.putInt("a", 0);
   e.commit();
   int n=spf.getInt("a", 0);
 
File
   root=Environment.getExternalStorageDirectory();
   StatFs s=new StatFs(root.getPath());
   int totalSize=s.getBlockSize()*s.getBlockCount()/1024/1024;
 
数据存储的读写
先检测内存有没有,内存有则直接显示
内存中的缓存借助LruCache对象实现
的底层实现是一个LinkedHashMap(能保证key的添加顺序)
在使用LruCache应至少重写一个方法sizeOf
检测磁盘中有没有,磁盘有就要读到内存,然后显示
磁盘中的缓存是借助DiskLruCache实现
具体数据操作(例如写数据)需要借助Editor对象
磁盘没有,则从网络读取缓存到磁盘,然后在到内存进行缓存,然后显示
   
LruCache
   ActivityManager am=(ActivityManager) getSystemService(ACTIVITY_SERVICE);
   int i=am.getMemoryClass();
   int size=i*1024*1024/8;
   lc=new LruCache<String, Bitmap>(size){
      @Override
      protected int sizeOf(String key, Bitmap value) {
      return value.getByteCount();}};
put  get 方法 存储数据 获得数据
     
DiskLruCache
   5
 
SQLite
   sqld=openOrCreateDatabase("cqq.db", MODE_PRIVATE, null);
   String sql="create table if not exists caicai(_id integer primary key,phone text not null,name text not null,created text not null)";
   sqld.execSQL(sql);
菜菜','1993-09-21')";
   sqld.execSQL(ins);
   ContentValues c=new ContentValu` - 7-+ es();
   c.put("_id", 1);
   c.put("phone", "15110289192");
   sqld.insert("caicai", null, c);
   String s="select * from caicai where phone like ?";
   Cursor c=sqld.rawQuery(s, new String[]{"151%"});
   c.moveToFirst()
   c.moveToNext()
 
 
 
D:\software\android sdk_4_5_6\samples\android-23\ui\DisplayingBitmaps\Application\src\main\java\com\example\android\displayingbitmaps\util
 
 
ScheduledExecutorService ses=Executors.newSingleThreadScheduledExecutor();
ses.schedule(new Runnable() {
public void run() {
System.out.println(5);
}
}, 5, TimeUnit.SECONDS);//延迟5秒后 执行
 
 
/*ses.scheduleAtFixedRate(command,
initialDelay,   初始延迟
period,         下次任务的调度时间(无论上次任务有没有结束在period时间之后都会开启下一次调度)
unit)*/
/*ses.scheduleWithFixedDelay(command,
initialDelay,
delay,下次任务的调度时间(上次任务执行结束,再经过delay时间开始下一次的调度
unit)*/
 
Service
service
bindService()方法 用于启动service
unbindService()方法 解除绑定 并停止 service
Mainactivity 中想直接采用 service 中的方法时 可以通过 Ibinder 方法 返回一个service对象  通过此对象 调用方法
(用于执行初始化动作)  onBind 返回一个Ibinder接口的子类对象    onDestory() 用于释放资源
activity 是客户端 而service 是服务端 的C/S 架构
绑定机制支持跨进程通信
onServiceConnected()方法 得到 service 返回的 值
StartService)  intentService 会自动创建 工作线程 执行耗时操作 
方法中的onHandleIntent方法 重写  运行在工作线程
 
音乐播放器:
SQLite  ContentProvider    AsyncTask    Service notifycation   MediaPlayer    Activity
                ContentResover  
 
BroadcastReceiver  广播
   一般广播  有序广播(设置 清单配置文件的 优先级)
sendBroadcast(。。。)发送广播
 
Fragment
中的一个模块化组件   有自己独立的生命周期方法
Fragment      
activity的布局文件中配置 fragment  
activity代码中动态更新fragment
(fragmentPagerAdapter)   Item(Fragment)
 
Intent
对象会由context对象的相关方法传递给底层Android系统
intent(目标明确)
intent (目标不明确) 跨进程
setClass setAction  SetCoponent  setType   addCategory   put get
 
Activity
Activity   
startActivity(intent)   startActivityForResult(intent,requestCode);
Service
(intent)
(intent)
   发送广播
(intent)
   反射在程序运行时动态发现类中的属性  发  动态的执行相关方法
    通用编程     框架编程
.class    类的对象.getClass();    Class.forName(“包名.类名”);、
ContentProvider  ContentResolver
   SQLiteDatabase   SQLiteOpenHelper  Cursor
   ContentProvider UriMatcher  ContentUris
   ContentResolver   context.getResolver()
类型的对象需要注册 (*^__^*) 嘻嘻……
           <provider
            android:name="com.example.day106_3_contentprovider.MyContentProvider"
            android:authorities="lalala"
            android:enabled="true"
            android:exported="true" >
           </provider>
    关联的数据一般为 内部存储  其生命周期由系统管理
 
Service 执行耗时操作
对象所在的进程生命力更顽强一些 不容易在内存不足时 被杀死
startService(intent))
(1次)  onStartCommand(多次) onDestroy(1次)
stopService()停止  或在内部调用stopSelf()停止
bindService(intent))
(1次)  onStartCommand(多次) onDestroy(1次)
()停止
() binder() ServiceConnection();
对象所在进程可以转换为前台进程 可以调用startForground(0,ntf)方法 将service进程转换为前台进程
stopForeground将其在转换为后台进程
在被非正常停止时 可以自动启动  设置 粘性
可以自动启动 可以借助广播的
activity中希望直接调用service中相关方法时 采用绑定模式更好
    
IntentService  
   适合应用在执行完任务以后自动停止的场合
 
BroadCastReceiver  广播
对象类型
sendBroadcast())
sendOrderBroadcast())  
onReceiver()方法
receiver registerReceiver 注册  UNregisterReceiver)
();  setResultData();