第一:FrameLayout的妙用,架構布局是最簡單和最高效的布局類型之一。架構布局的子控制項被相對於布局的左上方來繪製。如果架構布局中存在多個子視圖,它們將按順序繪製,最後一個子控制項繪製在最上面。
樣本:。
第二:以前做J2ME平台,為了實現跑馬燈效果,實現方式是在UI線程(繪圖線程)不停的重新整理,通過改變座標來達到動畫效果。那時候看到Android上各種炫目的動畫,簡直嚇尿了,後來做了Android平台才知道,尿尿更健康。在Android平台,動畫效果封裝的非常好。簡單的動畫模型有兩種:tweened (透明/伸縮/移動/旋轉)和frame ,下面的下載連結有這兩種動畫的demo:http://download.csdn.net/detail/coding_or_coded/4367757
第三:Android平台的Gallery可以實現很棒的圖片拖動效果,demo:http://download.csdn.net/detail/coding_or_coded/4368287
第四:實現了一個非常棒的SharedPreferences封裝類
package com.imo.util;import android.content.Context;import android.content.SharedPreferences;import android.content.SharedPreferences.Editor;import com.imo.global.IMOApp;/** * SharedPreference封裝 */public class PreferenceManager {/** * 在指定的檔案中儲存資料 * * @param fileName * 檔案名稱 * @param objs * 數組{key,value} */public static void save(String fileName, Object[] objs) {try {SharedPreferences sp = IMOApp.getApp().getSharedPreferences(fileName,Context.MODE_APPEND);//IMOApp.getApp()代表ApplicationEditor editor = sp.edit();if (objs[1] instanceof String) {editor.putString(objs[0].toString(), objs[1].toString());} else if (objs[1] instanceof Integer) {editor.putInt(objs[0].toString(),Integer.parseInt(objs[1].toString()));} else if (objs[1] instanceof Long) {editor.putLong(objs[0].toString(),Long.parseLong((objs[1].toString())));} else if (objs[1] instanceof Float) {editor.putFloat(objs[0].toString(),Float.parseFloat((objs[1].toString())));} else if (objs[1] instanceof Boolean) {editor.putBoolean(objs[0].toString(),Boolean.parseBoolean((objs[1].toString())));}editor.commit();} catch (Exception e) {e.printStackTrace();}}/** * 在指定的檔案中讀取資料 * * @param fileName * 檔案名稱 * @param objs * 數組{key,defaultValue} */public static Object get(String fileName, Object[] objs) {try {SharedPreferences sp = IMOApp.getApp().getSharedPreferences(fileName,Context.MODE_APPEND);if (objs[1] instanceof String) {return sp.getString(objs[0].toString(), objs[1].toString());} else if (objs[1] instanceof Integer) {return sp.getInt(objs[0].toString(),Integer.parseInt(objs[1].toString()));} else if (objs[1] instanceof Long) {return sp.getLong(objs[0].toString(),Long.parseLong((objs[1].toString())));} else if (objs[1] instanceof Float) {return sp.getFloat(objs[0].toString(),Float.parseFloat((objs[1].toString())));} else if (objs[1] instanceof Boolean) {return sp.getBoolean(objs[0].toString(),Boolean.parseBoolean((objs[1].toString())));}} catch (Exception e) {e.printStackTrace();}return null;}}