当前位置:  编程技术>移动开发
本页文章导读:
    ▪游戏走过场动画效果        游戏过场动画效果 int effect, gridWidth, num, currentGridWidth, gridHeight, currentGridHeight, deltaWidth, deltaHeight, row, col, sx, sy, sw, sh; int scnWidth = MY_SCREEN_WIDTH; int scnWidth_Half = MY_SCREEN_WIDTH / 2; int scnHe.........
    ▪ service 里边使用toast        service 里面使用toast public class ConnectionService extends Service {     private Handler handler = new Handler();   public void restartConnection(){      int sleepTime = reconnectCounter * MIN_RECON_WAIT;      if (sleepTime > MAX_R.........
    ▪ ListView一些相干知识       ListView一些相关知识 ListView 中的第一行显示的格式是什么,是直接显示文字还是要“图文并茂”的显示。 Android 系统为我们提供了多种模板进行选择 (android.R.layout) ,如   Simple_list_item_1 每项.........

[1]游戏走过场动画效果
    来源: 互联网  发布时间: 2014-02-18
游戏过场动画效果
int effect, gridWidth, num, currentGridWidth,
        gridHeight, currentGridHeight, deltaWidth,
        deltaHeight, row, col, sx, sy, sw, sh;
int scnWidth = MY_SCREEN_WIDTH;
int scnWidth_Half = MY_SCREEN_WIDTH / 2;
int scnHeight = MY_SCREEN_HEIGHT;
int scnHeight_Half = MY_SCREEN_HEIGHT / 2;
 
/**
 * 初始化
 */
private void initEffect() {
    //subSelected = 0;
//     effect = getRandom(0, 20);
    effect = Math.abs(random.nextInt()) % 21;
    // System.out.println("Effect::" + effect);
    // effect = 19 + (ran.nextInt() >>> 1) % 2;
    // effect = 2;
    switch (effect) {
    default:
        break;
    case 0: {
        // 水平单一百叶窗效果
        gridWidth = scnWidth >> 2; // 每一条
        num = 4;
        currentGridWidth = 0;
        gridHeight = 0;
        currentGridHeight = 0;
        if (scnWidth == 176) {
            //deltaWidth = 8;
            deltaWidth = 8;
        } else if (scnWidth == 128) {
            deltaWidth = 2;
        } else {
            deltaWidth = 3;
        }
    }
    break;
    case 1: {
        // 竖直单一百叶窗效果
        gridHeight = scnHeight >> 2;
        num = 4;
        currentGridHeight = 0;
        currentGridWidth = 0;
        gridWidth = 0;
        if (scnWidth == 176) {
            deltaHeight = 8;
        } else if (scnWidth == 128) {
            deltaHeight = 2;
        } else {
            deltaHeight = 3;
        }
    }
    break;
    case 2: {
        // 纵横百叶窗效果
        gridWidth = scnWidth >> 1;
        gridHeight = scnHeight >> 1;
        currentGridWidth = 0;
        currentGridHeight = 0;
        num = 2;
        if (scnWidth == 176) {
            deltaWidth = 11;
            deltaHeight = 13;
        } else if (scnWidth == 128) {
            deltaWidth = 4;
            deltaHeight = 4;
        } else {
            deltaWidth = 8;
            deltaHeight = 9;
        }
    }
    break;
    [您有足够的威望或权限浏览此文章, 以下是加密内容:]
            case 3:
    case 4: {
        // 内聚/外散效果
        gridWidth = scnWidth >> 1;
        gridHeight = scnHeight >> 1;
        currentGridWidth = 0;
        currentGridHeight = 0;
        // num = 4;
        if (scnWidth == 176) {
            deltaWidth = 9;
            deltaHeight = 11;
        } else if (scnWidth == 128) {
            deltaWidth = 4;
            deltaHeight = 4;
        } else {
            deltaWidth = 9;
            deltaHeight = 11;
        }
    }
    break;
    case 5:
    case 6: {
        // 从左/右抽出
        currentGridWidth = 0;
        gridWidth = scnWidth;
        // col = 1;
        if (scnWidth == 176) {
            deltaWidth = 16;
        } else if (scnWidth == 128) {
            deltaWidth = 16;
        } else {
            deltaWidth = 16;
        }
    }
    break;
    case 7:
    case 8: {
        // 从上/下抽出
        currentGridHeight = 0;
        gridHeight = scnHeight;
        // row = 1;
        deltaHeight = 16;
    }
    break;
    case 9: // 从上下往中央
    case 10: {
        // 中央往上下
        currentGridHeight = 0;
        gridHeight = scnHeight_Half;
        deltaHeight = 8;
    }
    break;
    case 11: // 左右往中央
    case 12: {
        // 中央往左右
        currentGridWidth = 0;
        gridWidth = scnWidth_Half;
        deltaWidth = 8;
    }
    break;
    case 13: // 加号往外
    case 14: {
        // 加号往内
        currentGridHeight = currentGridWidth = 0;
        gridWidth = scnWidth_Half;
        gridHeight = scnHeight_Half;
        if (scnWidth == 176) {
            deltaWidth = 11;
            deltaHeight = 13;
        } else if (scnWidth == 128) {
            deltaWidth = deltaHeight = 8;
        } else {
            deltaWidth = 11;
            deltaHeight = 13;
        }
    }
    break;
    case 15: {
        // 从右上抽入
    }
    case 16: {
        // 从左上抽入
    }
    case 17: {
        // 从右下抽入
    }
    case 18: {
        // 从左下抽入
        currentGridHeight = currentGridWidth = 0;
        gridWidth = scnWidth;
        gridHeight = scnHeight;
        if (scnWidth == 176) {
            deltaWidth = 11;
            deltaHeight = 13;
        } else if (scnWidth == 128) {
            deltaWidth = deltaHeight = 8;
        } else {
            deltaWidth = 11;
            deltaHeight = 13;
        }
    }
    break;
    case 19: {
        // 水平梳理
        currentGridWidth = 0;
        gridWidth = scnWidth;
        gridHeight = scnHeight >> 2;
        row = 4;
        if (scnWidth == 176) {
            deltaWidth = 22;
        } else if (scnWidth == 128) {
            deltaWidth = 8;
        } else {
            deltaWidth = 8;
        }
    }
    break;
    case 20: {
        // 垂直梳理
        currentGridHeight = 0;
        gridHeight = scnHeight;
        gridWidth = scnWidth >> 2;
        col = 4;
        if (scnWidth == 176) {
            deltaHeight = 26;
        } else if (scnWidth == 128) {
            deltaHeight = 8;
        } else {
            deltaHeight = 8;
        }
    }
    break;
    }
    // 这里保证在过场动画显示过程中不会受到玩家按键的影响
    //cleanKeyStates(13);
    // gg.setClip(0, 0, scnWidth, scnHeight);
}
 
private void doPaintInterludeEffect() {
    switch (gameStates) {
    case -1:
        break;
    case 0:
        paintLogo();
        break;
    case 1:
        paintLoading();
        break;
    case 2:
        paintMainMenu();
        break;
    case 3:
        paintHelp();
        break;
    case 4:
        paintAbout();
        break;
    case 5:
        paintIntroduction();
        break;
    case 6:
        paintGuide();
        break;
    case 7:
        paintControl();
        break;
    case 8:
        paintCustom();
        break;
    case 9:
        paintStaff();
        break;
    case 10:
        paintOption();
        break;
    case 11:
        paintMain();
        break;
        /*********************** 玩家更新 ***********************/
    case GS_P_NAV: // 玩家选择单位
        paintGS_P_NAV();
        break;
    case GS_SYS_MENU: // 选择了空地,出现系统菜单
        paintGS_SYS_MENU();
        break;
    case GS_P_SLT_MOV: // 玩家选择移动目标
        paintGS_P_SLT_MOV();
        break;
 
    case GS_P_MOVING: // 玩家单位移动中
        paintGS_P_MOVING();
        break;
 
    case GS_P_CONFIRM_MOV: // 玩家确定移动菜单
        paintGS_P_CONFIRM_MOV();
        break;
    case GS_P_SLT_TARGET: // 玩家选择攻击目标
        paintGS_P_SLT_TARGET();
        break;
 
        /********************** 敌人更新 *********************/
    case GS_E_NAV: // 敌人选择单位
        paintGS_E_NAV();
        break;
    case GS_E_MOVING: // 敌人移动
        paintGS_E_MOVING();
        break;
        /********************** 公有更新 *********************/
    case GS_FIGHTING: // 战斗
        paintGS_FIGHTING();
        break;
    case GS_VIEW_UNIT_INFO: // 查看单位信息
        paintGS_VIEW_UNIT_INFO();
        break;
        /********************** 事件相关更新 *******************/
    case GS_TALK: // 对话
        paintGS_TALK();
        break;
 
    case GS_MOV: // 控制单位移动
        paintGS_MOV();
        break;
    case GS_FLASH_CELL: // 地块闪动
        paintGS_FLASH_CELL();
        break;
    }
}
 
/**
 * 画各种菜单/场景切换动画
 *
 * @author 薛永
 *
 *
 */
private void interludeEffect() {
    gg.setClip(0, 0, scnWidth, scnHeight);
    switch (effect) {
    default:
        break;
    case -1: {
        // 特效完毕
        sx = 0;
        sy = 0;
        sw = scnWidth;
        sh = scnHeight;
        switch (gameStates) {
        case -1:
            break;
        case 0:
            paintLogo();
            break;
        case 1:
            paintLoading();
            break;
        case 2:
            paintMainMenu();
            break;
        case 3:
            paintHelp();
            break;
        case 4:
            paintAbout();
            break;
        case 5:
            paintIntroduction();
            break;
        case 6:
            paintGuide();
            break;
        case 7:
            paintControl();
            break;
        case 8:
            paintCustom();
            break;
        case 9:
            paintStaff();
            break;
        case 10:
            paintOption();
            break;
        case 11:
            paintMain();
            break;
            /*********************** 玩家更新 ***********************/
        case GS_P_NAV: // 玩家选择单位
            paintGS_P_NAV();
            break;
        case GS_SYS_MENU: // 选择了空地,出现系统菜单
            paintGS_SYS_MENU();
            break;
        case GS_P_SLT_MOV: // 玩家选择移动目标
            paintGS_P_SLT_MOV();
            break;
 
        case GS_P_MOVING: // 玩家单位移动中
            paintGS_P_MOVING();
            break;
 
        case GS_P_CONFIRM_MOV: // 玩家确定移动菜单
            paintGS_P_CONFIRM_MOV();
            break;
        case GS_P_SLT_TARGET: // 玩家选择攻击目标
            paintGS_P_SLT_TARGET();
            break;
 
            /********************** 敌人更新 *********************/
        case GS_E_NAV: // 敌人选择单位
            paintGS_E_NAV();
            break;
        case GS_E_MOVING: // 敌人移动
            paintGS_E_MOVING();
            break;
            /********************** 公有更新 *********************/
        case GS_FIGHTING: // 战斗
            paintGS_FIGHTING();
            break;
        case GS_VIEW_UNIT_INFO: // 查看单位信息
            paintGS_VIEW_UNIT_INFO();
            break;
            /********************** 事件相关更新 *******************/
        case GS_TALK: // 对话
            paintGS_TALK();
            break;
 
        case GS_MOV: // 控制单位移动
            paintGS_MOV();
            break;
        case GS_FLASH_CELL: // 地块闪动
            paintGS_FLASH_CELL();
            break;
        }
 
    }
    break;
    case 1: {
        // 水平百叶窗
        if (currentGridHeight < gridHeight) {
            currentGridHeight += (deltaHeight++);
            for (int i = num; --i >= 0; ) {
                // gg.setColor(color);
                // gg.fillRect(0, i * gridLen, scnWidth, currentGridLen);
                sx = 0;
                sy = i * gridHeight;
                sw = scnWidth;
                sh = currentGridHeight;
                gg.setClip(0, i * gridHeight, scnWidth, currentGridHeight);
                doPaintInterludeEffect();
                gg.setClip(0, 0, scnWidth, scnHeight);
            }
        } else {
            effect = -1;
        }
    }
    break;
    case 0: {
        // 垂直百叶窗
        if (currentGridWidth < gridWidth) {
            currentGridWidth += (deltaWidth++);
            for (int i = num; --i >= 0; ) {
                // gg.setColor(color);
                sx = i * gridWidth;
                sy = 0;
                sw = currentGridWidth;
                sh = scnHeight;
                gg.setClip(i * gridWidth, 0, currentGridWidth, scnHeight);
                doPaintInterludeEffect();
                gg.setClip(0, 0, scnWidth, scnHeight);
            }
        } else {
            effect = -1;
        }
    }
    break;
    case 2: {
        // 水平纵横交错百叶窗
        if (currentGridHeight < gridHeight) {
            // S60:: 176 * 208
            currentGridHeight += (deltaHeight++);
            currentGridWidth += (deltaWidth++);
            // S40:: 128 * 128
            // currentGridHeight += 4;
            // currentGridWidth += 4;
            for (int i = num; --i >= 0; ) {
                for (int j = num; --j >= 0; ) {
                    sx = j * gridWidth;
                    sy = i * gridHeight;
                    sw = currentGridWidth;
                    sh = currentGridHeight;
                    gg.setClip(j * gridWidth, i * gridHeight,
                               currentGridWidth, currentGridHeight);
                    doPaintInterludeEffect();
                    gg.setClip(0, 0, scnWidth, scnHeight);
                }
            }
        } else {
            effect = -1;
        }
    }
    break;
    case 3: {
        // 内聚效果
        if (currentGridHeight < gridHeight) {
            // S60:: 176 * 208
            currentGridHeight += (deltaHeight++);
            currentGridWidth += (deltaWidth++);
            // S40::128 * 128
            // currentGridHeight += 4;
            // currentGridWidth += 4;
            sx = scnWidth_Half - currentGridWidth;
            sy = scnHeight_Half - currentGridHeight;
            sw = currentGridWidth << 1;
            sh = currentGridHeight << 1;
            gg.setClip(scnWidth_Half - currentGridWidth, scnHeight_Half
                       - currentGridHeight, currentGridWidth << 1,
                       currentGridHeight << 1);
            doPaintInterludeEffect();
            gg.setClip(0, 0, scnWidth, scnHeight);
            // for (int i = num; --i >= 0;) {
            // for (int j = num; --j >= 0;) {
            // gg.setClip(scnWidth_Half - currentGridWidth,
            // scnHeight_Half - currentGridHeight,
            // currentGridWidth << 1, currentGridHeight << 1);
            // doPaintCreatePlayer();
            // gg.setClip(0, 0, scnWidth, scnHeight);
            // }
            // }
        } else {
            effect = -1;
        }
    }
    break;
    case 4: {
        // 外散效果
        if (currentGridHeight < gridHeight) {
            // S60::176 * 208
            currentGridHeight += (deltaHeight++);
            currentGridWidth += (deltaWidth++);
            // S40::128 * 128
            // currentGridHeight += 4;
            // currentGridWidth += 4;
            sx = 0;
            sy = 0;
            sw = scnWidth;
            sh = currentGridHeight;
            gg.setClip(0, 0, scnWidth, currentGridHeight);
            doPaintInterludeEffect();
            gg.setClip(0, 0, scnWidth, scnHeight);
            sx = 0;
            sy = scnHeight - currentGridHeight;
            sw = scnWidth;
            sh = currentGridHeight;
            gg.setClip(0, scnHeight - currentGridHeight, scnWidth,
                       currentGridHeight);
            doPaintInterludeEffect();
            gg.setClip(0, 0, scnWidth, scnHeight);
            sx = 0;
            sy = currentGridHeight;
            sw = currentGridWidth;
            sh = (scnHeight_Half - currentGridHeight) << 1;
            gg.setClip(0, currentGridHeight, currentGridWidth,
                       (scnHeight_Half - currentGridHeight) << 1);
            doPaintInterludeEffect();
            gg.setClip(0, 0, scnWidth, scnHeight);
            sx = scnWidth - currentGridWidth;
            sy = currentGridHeight;
            sw = currentGridWidth;
            sh = (scnHeight_Half - currentGridHeight) << 1;
            gg.setClip(scnWidth - currentGridWidth, currentGridHeight,
                       currentGridWidth,
                       (scnHeight_Half - currentGridHeight) << 1);
            doPaintInterludeEffect();
            gg.setClip(0, 0, scnWidth, scnHeight);
        } else {
            effect = -1;
        }
    }
    break;
    case 5: {
        // 从左抽出
        if (currentGridWidth < gridWidth) {
            currentGridWidth += (deltaWidth++);
            sx = 0;
            sy = 0;
            sw = currentGridWidth;
            sh = scnHeight;
            gg.setClip(0, 0, currentGridWidth, scnHeight);
            doPaintInterludeEffect();
            gg.setClip(0, 0, scnWidth, scnHeight);
        } else {
            effect = -1;
        }
    }
    break;
    case 6: {
        // 从右抽出
        if (currentGridWidth < gridWidth) {
            currentGridWidth += (deltaWidth++);
            sx = scnWidth - currentGridWidth;
            sy = 0;
            sw = currentGridWidth;
            sh = scnHeight;
            gg.setClip(scnWidth - currentGridWidth, 0, currentGridWidth,
                       scnHeight);
            doPaintInterludeEffect();
            gg.setClip(0, 0, scnWidth, scnHeight);
        } else {
            effect = -1;
        }
    }
    break;
    case 7: {
        // 从上抽出
        if (currentGridHeight < gridHeight) {
            currentGridHeight += (deltaHeight++);
            sx = 0;
            sy = 0;
            sw = scnWidth;
            sh = currentGridHeight;
            gg.setClip(0, 0, scnWidth, currentGridHeight);
            doPaintInterludeEffect();
            gg.setClip(0, 0, scnWidth, scnHeight);
        } else {
            effect = -1;
        }
    }
    break;
    case 8: {
        // 从下抽出
        if (currentGridHeight < gridHeight) {
            currentGridHeight += (deltaHeight++);
            sx = 0;
            sy = scnHeight - currentGridHeight;
            sw = scnWidth;
            sh = currentGridHeight;
            gg.setClip(0, scnHeight - currentGridHeight, scnWidth,
                       currentGridHeight);
            doPaintInterludeEffect();
            gg.setClip(0, 0, scnWidth, scnHeight);
        } else {
            effect = -1;
        }
    }
    break;
    case 9: {
        // 上下往中央
        if (currentGridHeight < gridHeight) {
            currentGridHeight += (deltaHeight++);
            sx = 0;
            sy = 0;
            sw = scnWidth;
            sh = currentGridHeight;
            gg.setClip(0, 0, scnWidth, currentGridHeight);
            doPaintInterludeEffect();
            gg.setClip(0, 0, scnWidth, scnHeight);
            sx = 0;
            sy = scnHeight - currentGridHeight;
            sw = scnWidth;
            sh = currentGridHeight;
            gg.setClip(0, scnHeight - currentGridHeight, scnWidth,
                       currentGridHeight);
            doPaintInterludeEffect();
            gg.setClip(0, 0, scnWidth, scnHeight);
        } else {
            effect = -1;
        }
    }
    break;
    case 10: {
        // 中央往上下
        if (currentGridHeight < gridHeight) {
            currentGridHeight += (deltaHeight++);
            sx = 0;
            sy = gridHeight - currentGridHeight;
            sw = scnWidth;
            sh = currentGridHeight << 1;
            gg.setClip(0, gridHeight - currentGridHeight, scnWidth,
                       currentGridHeight << 1);
            doPaintInterludeEffect();
            gg.setClip(0, 0, scnWidth, scnHeight);
        } else {
            effect = -1;
        }
    }
    break;
    case 11: {
        // 左右往中央
        if (currentGridWidth < gridWidth) {
            currentGridWidth += (deltaWidth++);
            sx = 0;
            sy = 0;
            sw = currentGridWidth;
            sh = scnHeight;
            gg.setClip(0, 0, currentGridWidth, scnHeight);
            doPaintInterludeEffect();
            gg.setClip(0, 0, scnWidth, scnHeight);
            sx = scnWidth - currentGridWidth;
            sy = 0;
            sw = currentGridWidth;
            sh = scnHeight;
            gg.setClip(scnWidth - currentGridWidth, 0, currentGridWidth,
                       scnHeight);
            doPaintInterludeEffect();
            gg.setClip(0, 0, scnWidth, scnHeight);
        } else {
            effect = -1;
        }
    }
    break;
    case 12: {
        // 中央往左右
        if (currentGridWidth < gridWidth) {
            currentGridWidth += (deltaWidth++);
            sx = gridWidth - currentGridWidth;
            sy = 0;
            sw = currentGridWidth << 1;
            sh = scnHeight;
            gg.setClip(gridWidth - currentGridWidth, 0,
                       currentGridWidth << 1, scnHeight);
            doPaintInterludeEffect();
            gg.setClip(0, 0, scnWidth, scnHeight);
        } else {
            effect = -1;
        }
    }
    break;
    case 13: {
        // 加号向外
        if (currentGridHeight < gridHeight) {
            currentGridHeight += (deltaHeight++);
            currentGridWidth += (deltaWidth++);
            sx = 0;
            sy = gridHeight - currentGridHeight;
            sw = scnWidth;
            sh = currentGridHeight << 1;
            gg.setClip(0, gridHeight - currentGridHeight, scnWidth,
                       currentGridHeight << 1);
            doPaintInterludeEffect();
            gg.setClip(0, 0, scnWidth, scnHeight);
            sx = gridWidth - currentGridWidth;
            sy = 0;
            sw = currentGridWidth << 1;
            sh = gridHeight - currentGridHeight;
            gg.setClip(gridWidth - currentGridWidth, 0,
                       currentGridWidth << 1, gridHeight - currentGridHeight);
            doPaintInterludeEffect();
            gg.setClip(0, 0, scnWidth, scnHeight);
            sx = gridWidth - currentGridWidth;
            sy = gridHeight + currentGridHeight;
            sw = currentGridWidth << 1;
            sh = gridHeight - currentGridHeight;
            gg.setClip(gridWidth - currentGridWidth, gridHeight
                       + currentGridHeight, currentGridWidth << 1, gridHeight
                       - currentGridHeight);
            doPaintInterludeEffect();
            gg.setClip(0, 0, scnWidth, scnHeight);
        } else {
            effect = -1;
        }
    }
    break;
    case 14: {
        // 加号向内
        if (currentGridWidth < gridWidth) {
            currentGridHeight += (deltaHeight++);
            currentGridWidth += (deltaWidth++);
            int _width = currentGridWidth;
            int _height = currentGridHeight;
            sx = 0;
            sy = 0;
            sw = _width;
            sh = _height;
            gg.setClip(0, 0, _width, _height);
            doPaintInterludeEffect();
            gg.setClip(0, 0, scnWidth, scnHeight);
            sx = 0;
            sy = scnHeight - currentGridHeight;
            sw = _width;
            sh = _height;
            gg.setClip(0, scnHeight - currentGridHeight, _width, _height);
            doPaintInterludeEffect();
            gg.setClip(0, 0, scnWidth, scnHeight);
            sx = scnWidth - currentGridWidth;
            sy = 0;
            sw = _width;
            sh = _height;
            gg.setClip(scnWidth - currentGridWidth, 0, _width, _height);
            doPaintInterludeEffect();
            gg.setClip(0, 0, scnWidth, scnWidth);
            sx = scnWidth - currentGridWidth;
            sy = scnHeight - currentGridHeight;
            sw = _width;
            sh = _height;
            gg.setClip(scnWidth - currentGridWidth, scnHeight
                       - currentGridHeight, _width, _height);
            doPaintInterludeEffect();
            gg.setClip(0, 0, scnWidth, scnHeight);
        } else {
            effect = -1;
        }
    }
    break;
    case 15: {
        // 向右上抽入
        if (currentGridHeight < gridHeight) {
            currentGridHeight += (deltaHeight++);
            currentGridWidth += (deltaWidth++);
            sx = 0;
            sy = scnHeight - currentGridHeight;
            sw = currentGridWidth;
            sh = currentGridHeight;
            gg.setClip(0, scnHeight - currentGridHeight, currentGridWidth,
                       currentGridHeight);
            doPaintInterludeEffect();
            gg.setClip(0, 0, scnWidth, scnHeight);
        } else {
            effect = -1;
        }
    }
    break;
    case 16: {
        // 向左上抽入
        if (currentGridHeight < gridHeight) {
            currentGridHeight += (deltaHeight++);
            currentGridWidth += (deltaWidth++);
            sx = gridWidth - currentGridWidth;
            sy = gridHeight - currentGridHeight;
            sw = currentGridWidth;
            sh = currentGridHeight;
            gg.setClip(gridWidth - currentGridWidth, gridHeight
                       - currentGridHeight, currentGridWidth,
                       currentGridHeight);
            doPaintInterludeEffect();
            gg.setClip(0, 0, scnWidth, scnHeight);
        } else {
            effect = -1;
        }
    }
    break;
    case 17: {
        // 向右下抽入
        if (currentGridHeight < gridHeight) {
            currentGridHeight += (deltaHeight++);
            currentGridWidth += (deltaWidth++);
            sx = 0;
            sy = 0;
            sw = currentGridWidth;
            sh = currentGridHeight;
            gg.setClip(0, 0, currentGridWidth, currentGridHeight);
            doPaintInterludeEffect();
            gg.setClip(0, 0, scnWidth, scnHeight);
        } else {
            effect = -1;
        }
    }
    break;
    case 18: {
        // 向左下抽入
        if (currentGridHeight < gridHeight) {
            currentGridHeight += (deltaHeight++);
            currentGridWidth += (deltaWidth++);
            sx = scnWidth - currentGridWidth;
            sy = 0;
            sw = currentGridWidth;
            sh = currentGridHeight;
            gg.setClip(scnWidth - currentGridWidth, 0, currentGridWidth,
                       currentGridHeight);
            doPaintInterludeEffect();
            gg.setClip(0, 0, scnWidth, scnHeight);
        } else {
            effect = -1;
        }
    }
    break;
    case 19: {
        // 水平梳理
        if (currentGridWidth < gridWidth) {
            currentGridWidth += (deltaWidth++);
            for (int i = row; --i >= 0; ) {
                if ((i & 1) == 0) {
                    sx = 0;
                    sy = (i) * gridHeight;
                    sw = currentGridWidth;
                    sh = gridHeight;
                    gg.setClip(0, (i) * gridHeight, currentGridWidth,
                               gridHeight);
                } else {
                    sx = scnWidth - currentGridWidth;
                    sy = (i) * gridHeight;
                    sw = currentGridWidth;
                    sh = gridHeight;
                    gg.setClip(scnWidth - currentGridWidth, (i)
                               * gridHeight, currentGridWidth, gridHeight);
                }
                doPaintInterludeEffect();
                gg.setClip(0, 0, scnWidth, scnHeight);
            }
        } else {
            effect = -1;
        }
    }
    break;
    case 20: {
        // 垂直梳理
        if (currentGridHeight < gridHeight) {
            currentGridHeight += (deltaHeight++);
            for (</pr
 

    
[2] service 里边使用toast
    来源: 互联网  发布时间: 2014-02-18
service 里面使用toast

public class ConnectionService extends Service {  
  private Handler handler = new Handler();

  public void restartConnection(){
     int sleepTime = reconnectCounter * MIN_RECON_WAIT;
     if (sleepTime > MAX_RECON_WAIT)
     {
        sleepTime = MAX_RECON_WAIT;
     }
     String msg = "The connection has been lost.  Restart attempt will start in: " + sleepTime/1000 + " seconds";
     (new Timer()).schedule(
     new TimerTask() {
        public void run() {
           handler.post(new Runnable() {
              public void run() {
                 Toast.makeText(getApplicationContext(), "msg", Toast.LENGTH_LONG).show();
                 reconnectCounter++;
                 this.startConnectionThread()
              }
           });
        }
     }, sleepTime);
  }//end restartConnection

}//end ConnectionService
这里是其中一种方法


    
[3] ListView一些相干知识
    来源: 互联网  发布时间: 2014-02-18
ListView一些相关知识

ListView 中的第一行显示的格式是什么,是直接显示文字还是要“图文并茂”的显示。

Android 系统为我们提供了多种模板进行选择 (android.R.layout) ,如

  Simple_list_item_1 每项有一个 TextView

  Simple_list_item_2 每项有两个 TextView

  Simple_list_item_checked 带 CheckView 的项

  Simple_list_item_multiple_choise 每项有一个 TextView 并可以多选

  Simple_list_item_single_choice 每项有一个 TextView ,但只能进行单选。 

 

 

 

ArrayAdapter的用法

  ListView listView;

  String[] data = { "Item1", "Item2",

        "Item3", "Item4", "Item5" };

  listView=(ListView)findViewById(R.id.lv);

  listView.setAdapter(new ArrayAdapter<String>(this,

     android.R.layout.simple_list_item_single_choice, data)); 

SimpleAdapter的用法

simpleAdapter 的构造函数 如下:

SimpleAdapter(Context context, List <? extends Map <String, ?>> data, int resource, String[] from, int[] to)

一个 SimlpleAdapter 是这个工作的。假设将 SimpleAdapter 用于 ListView 。那么 ListView 的每一个列表项就是 resource 参数值指定的布局。而 data 参数就是要加载到 ListView 中的数据。我们先看每一个列表项,假设列表项所对应的布局文件中包含了两个组件: TextView 和 EditText , id 分别为 textview 和 edittext 。那么在加载列表项时,需要通过组件的 id 和 data 参数中 List 元素中的 Map 对象对应。因此, from 参数 Map 对象的 key ,而 to 表示组件的 id ,例如,本例中的参数值为 from = new String[]{"textview", "edittext"} , to = new int[]{R.id.textview , R.id.edittext} 。意思就是将 Map 对象中 key 为 textview 的 value 绑定到 R.id.textview 上, edittext 也类似。

现在来看 data 参数,一个 ListView 由多个列表项组成。每一个列表项由一个 Map 对象提供数据,而多个列表项则由 List 对象提供多个 Map 对象


    
最新技术文章:
▪Android开发之登录验证实例教程
▪Android开发之注册登录方法示例
▪Android获取手机SIM卡运营商信息的方法
▪Android实现将已发送的短信写入短信数据库的...
▪Android发送短信功能代码
▪Android根据电话号码获得联系人头像实例代码
▪Android中GPS定位的用法实例
▪Android实现退出时关闭所有Activity的方法
▪Android实现文件的分割和组装
▪Android录音应用实例教程
▪Android双击返回键退出程序的实现方法
▪Android实现侦听电池状态显示、电量及充电动...
▪Android获取当前已连接的wifi信号强度的方法
▪Android实现动态显示或隐藏密码输入框的内容
▪根据USER-AGENT判断手机类型并跳转到相应的app...
▪Android Touch事件分发过程详解
▪Android中实现为TextView添加多个可点击的文本
▪Android程序设计之AIDL实例详解
▪Android显式启动与隐式启动Activity的区别介绍
▪Android按钮单击事件的四种常用写法总结
▪Android消息处理机制Looper和Handler详解
▪Android实现Back功能代码片段总结
▪Android实用的代码片段 常用代码总结
▪Android实现弹出键盘的方法
php开源软件 iis7站长之家
▪Android提高之自定义Menu(TabMenu)实现方法
▪Android提高之多方向抽屉实现方法
▪Android提高之MediaPlayer播放网络音频的实现方法...
▪Android提高之MediaPlayer播放网络视频的实现方法...
▪Android提高之手游转电视游戏的模拟操控
 


站内导航:


特别声明:169IT网站部分信息来自互联网,如果侵犯您的权利,请及时告知,本站将立即删除!

©2012-2021,,E-mail:www_#163.com(请将#改为@)

浙ICP备11055608号-3