当前位置:  编程技术>移动开发
本页文章导读:
    ▪设立活动分区,取消活动分区标识        设置活动分区,取消活动分区标识 提示:如何设置活动分区,如何取消活动分区标识!一、活动分区和非活动分区       活动分区是计算机启动分区,就是写有引导数据的主分区,可.........
    ▪ 设立分区ID        设置分区ID 1.打开windows开始菜单,在运行栏中输入:cmd,回车,打开windows命令窗口2.在命令窗口中键入:diskpart,回车3.当光标前面变成DISKPART>后,键入select disk 0 回车(此步即选择你安装.........
    ▪ Launcher 圆桌面的3D转屏效果实现(1)-matrix setPolyToPoly       Launcher 桌面的3D转屏效果实现(1)-matrix setPolyToPoly 从现有方法来讲为了实现桌面的3D转屏效果主要是通过Launcher中的workspace实现(现有的有源码的方法),具体实现见:      http://www.eoeandroi.........

[1]设立活动分区,取消活动分区标识
    来源: 互联网  发布时间: 2014-02-18
设置活动分区,取消活动分区标识
提示:如何设置活动分区,如何取消活动分区标识!

一、活动分区和非活动分区

       活动分区是计算机启动分区,就是写有引导数据的主分区,可以用来引导系统。操作系统的启动文件都装在这个分区,windows系统下一般被默认为C盘,而Linux则根据具体设置而定。启动系统时,活动分区上的操作系统将执行一个称为驱动器映像的过程,它给主分区和逻辑驱动器分配驱动器名。所有的主分区首先被映像,而逻辑驱动器用后续的字母指定。

二、将磁盘分区标为活动

方法1:使用windows界面:
1. 在“运行”里输入"compmgmt.msc"(打开计算机管理);
2. 在控制台树种,单击"计算机管理"-"存储"-"磁盘管理";
3. 在需要标为活动的分区上,点击"右键",点击"将磁盘分区标为活动的"。

方法2:使用命令行:
1. 在"运行"里,输入"cmd";
2. 接着输入"diskpart";
3. 接着输入"list disk";
4. 接着输入"select disk 0"比如我们现在要将第1硬盘的第1分区做为活动的;
5. 接着输入"list partition";
6. 接着输入"select partition 1";
7. 最后输入"active"。

三、将磁盘分区取消活动

方法一:使用命令行,因为windows界面的那个选项卡已经变为浅色的不可以勾选了。

1.命令行提示符,运行DISKPART,运行入提示符变成"DISKPART>";
2.使用"LIST DISK"命令确定你的移动硬盘的##号;
3.使用"Select DISK 0"将你的移动磁盘设置成当前操作磁盘;
4.使用"Select PARTITION 1"将第一个分区设置成当前的操作分区;
5.使用"INACTIVE"命令解除当前分区的活动状态。

方法二:你可以用分区魔术师(Partition Magic)来进行,操作方法和磁盘管理差不多

    
[2] 设立分区ID
    来源: 互联网  发布时间: 2014-02-18
设置分区ID
1.打开windows开始菜单,在运行栏中输入:cmd,回车,打开windows命令窗口

2.在命令窗口中键入:diskpart,回车

3.当光标前面变成DISKPART>后,键入select disk 0 回车(此步即选择你安装雪豹的那个硬盘,如果是单硬盘的话,一般都是disk 0,注意disk和0之间有空格!!)

4.窗口提示:磁盘0是所选磁盘,再键入list partition 回车,屏幕显示硬盘上的各个分区

5.找到你的雪豹系统所在的分区,记住分区号,这里假设是x分区(你不会不知道你的雪豹安装在哪个分区了吧??!晕,看大小不就知道了,hehehe)

6.键入:select partition x,回车,屏幕提示:分区x是所选分区

7.键入:set ID=AF 回车,屏幕提示:diskpart已成功更改分区ID,大功告成!

    
[3] Launcher 圆桌面的3D转屏效果实现(1)-matrix setPolyToPoly
    来源: 互联网  发布时间: 2014-02-18
Launcher 桌面的3D转屏效果实现(1)-matrix setPolyToPoly

从现有方法来讲为了实现桌面的3D转屏效果主要是通过Launcher中的workspace实现(现有的有源码的方法),具体实现见:

     http://www.eoeandroid.com/viewthread.php?tid=27079&extra=&page=1 (写这篇文章也是为了“报答”该作者开源的贡献,共同学习)

 

     不过该方法存在以下几个问题:

  • 不同机器的分辨率和内存大小不同,从而使用cache保持截图的方法很有可能会出现内存方面的错误
  • 界面上面的变化,例如图标增加和删除,需要程序对应做出很多修改,用以保证整体效果的统一。其根本原因就是修改的模块位置在Launcher中过于考上
  • 图标变形和覆盖(我在2.2源码上总是搞不出来,╮(╯▽╰)╭)
  •      转载请注明http://ishelf.iteye.com/admin/blogs/836929

     

         依据以上问题本文从每个屏的dispatchDraw入手,修改CellLayout的dispatchDraw方法,这篇文章先给出2D的实现方式(利用Matrix实现):

          由于代码过多,本文只给出做过修改的代码

    ///CellLayout.java
    
     
      @Override
        public void dispatchDraw(Canvas canvas) {
            long start_time = System.currentTimeMillis();
            startRotate(canvas, currentX, canvas.getWidth(), canvas.getHeight());
            super.dispatchDraw(canvas);
            canvas.restore();
            long end_time = System.currentTimeMillis();
            Log.d("CellLayout" + currentScrenn, (end_time - start_time) + " ms");
        }
        // 上面的Log信息是用来对比用opengl实现两者效率
       
        //startRotate使用来计算该屏显示的位置以及显示的大小,xCor是手指移动的位置大小
       public void startRotate(Canvas mCanvas, float xCor, int width, int height) {
            boolean flag = true;
            if (isCurrentScrenn && xCor < 0) {
                xCor = width + xCor;
                flag = false;
            } else if (isCurrentScrenn && xCor >= 0) {
                // xCor = width - xCor;
            } else if (!isCurrentScrenn && xCor < 0) {
                xCor = width + xCor;
            } else if (!isCurrentScrenn && xCor >= 0) {
                flag = false;
            }
            final float SPAN = 0.000424f;
            float f = xCor - 10;
            if (f <= 0) {
                f = 0;
                xCor = 10;
            }// the maximum left
            float value = f * SPAN;
            if (f > width) {
                xCor = width - 10;
                value = 0.127225f;
            }// the maximum right
    
            if (isBorder) {
                doDraw(mCanvas, new float[] {
                        0, 0, width, 0, width, height, 0, height
                }, new float[] {
                        0, 0, width, 0, width, height, 0, height
                });
            } else if (!flag) {
                doDraw(mCanvas, new float[] {
                        0, 0, width, 0, width, height, 0, height
                }, new float[] {
                        0, 0, xCor, height * (1 / 7.0f - value), xCor, height * (6 / 7.0f + value), 0,
                        height
    
                });
            } else {
                doDraw(mCanvas, new float[] {
                        0, 0, width, 0, width, height, 0, height
                }, new float[] {
                        xCor, height * (1 / 30.0f + value), width, 0, width, height, xCor,
                        height * (29 / 30.0f - value)
                });
            }
        }
    
        private Matrix mMatrix = new Matrix();
    
        private int currentScrenn;
    
        private Paint mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    
        private boolean isBorder;
       
        //doDraw使用计算该屏如何变形,这里使用matrix的polyToPoly来实现,具体描述见APIDemo
        private void doDraw(Canvas canvas, float src[], float dst[]) {
            canvas.save();
            mMatrix.setPolyToPoly(src, 0, dst, 0, src.length >> 1);
            canvas.concat(mMatrix);
            switch (currentScrenn) {
                case 0:
                    mPaint.setColor(Color.RED);
                    break;
                case 1:
                    mPaint.setColor(Color.BLUE);
                    break;
                case 2:
                    mPaint.setColor(Color.YELLOW);
                    break;
                case 3:
                    mPaint.setColor(Color.CYAN);
                    break;
                case 4:
                    mPaint.setColor(Color.GREEN);
                    break;
            }
            mPaint.setStyle(Paint.Style.FILL_AND_STROKE);
            canvas.drawRect(0, 0, src[4], src[5], mPaint);
        }
    
    

     

        以下是workspace,该类主要是要传给cellLayout移动的参数

     

    // 该方法用来画屏   
     protected void dispatchDraw(Canvas canvas) {
            boolean restore = false;
            int restoreCount = 0;
    
            // ViewGroup.dispatchDraw() supports many features we don't need:
            // clip to padding, layout animation, animation listener, disappearing
            // children, etc. The following implementation attempts to fast-track
            // the drawing dispatch by drawing only what we know needs to be drawn.
    
            boolean fastDraw = mTouchState != TOUCH_STATE_SCROLLING && mNextScreen == INVALID_SCREEN;
            Log.d("Scroller","dispatchDraw"+mScrollX);
            // If we are not scrolling or flinging, draw only the current screen
            if (fastDraw) {
                ((CellLayout) getChildAt(mCurrentScreen)).setPara(mCurrentScreen,
                        (mCurrentScreen - mCurrentScreen) >= 0 ? true : false, true,
                        mChangeMotionX - mLastMotionX);
                drawChild(canvas, getChildAt(mCurrentScreen), getDrawingTime());
            } else {
                final long drawingTime = getDrawingTime();
                final float scrollPos = (float) mScrollX / getWidth();
                final int leftScreen = (int) scrollPos;
                final int rightScreen = leftScreen + 1;
            
                if (leftScreen >= 0) {
                    ((CellLayout) getChildAt(leftScreen)).setPara(leftScreen,
                            (leftScreen - mCurrentScreen) >= 0 ? true : false, scrollPos == leftScreen,
                            mChangeMotionX - mLastMotionX);
                    drawChild(canvas, getChildAt(leftScreen), drawingTime);
                }
                if (scrollPos != leftScreen && rightScreen < getChildCount()) {
                    ((CellLayout) getChildAt(rightScreen)).setPara(rightScreen, mCurrentScreen
                            - rightScreen >= 0 ? true : false, scrollPos == leftScreen, mChangeMotionX
                            - mLastMotionX);
                    drawChild(canvas, getChildAt(rightScreen), drawingTime);
                }
            }
    
            if (restore) {
                canvas.restoreToCount(restoreCount);
            }
        }
    
        @Override
        public boolean onTouchEvent(MotionEvent ev) {
    
            if (mLauncher.isWorkspaceLocked()) {
                return false; // We don't want the events. Let them fall through to
                // the all apps view.
            }
            if (mLauncher.isAllAppsVisible()) {
                // Cancel any scrolling that is in progress.
                if (!mScroller.isFinished()) {
                    mScroller.abortAnimation();
                }
                snapToScreen(mCurrentScreen);
                return false; // We don't want the events. Let them fall through to
                // the all apps view.
            }
    
            if (mVelocityTracker == null) {
                mVelocityTracker = VelocityTracker.obtain();
            }
            mVelocityTracker.addMovement(ev);
    
            final int action = ev.getAction();
    
            switch (action & MotionEvent.ACTION_MASK) {
                case MotionEvent.ACTION_DOWN:
                    /*
                     * If being flinged and user touches, stop the fling. isFinished
                     * will be false if being flinged.
                     */
                    if (!mScroller.isFinished()) {
                        mScroller.abortAnimation();
                    }
    
                    // Remember where the motion event started
                    mLastMotionX = ev.getX();
                    mChangeMotionX = mLastMotionX;
                    mActivePointerId = ev.getPointerId(0);
                    if (mTouchState == TOUCH_STATE_SCROLLING) {
                        enableChildrenCache(mCurrentScreen - 1, mCurrentScreen + 1);
                    }
                    break;
                case MotionEvent.ACTION_MOVE:
                    if (mTouchState == TOUCH_STATE_SCROLLING) {
                        // Scroll to follow the motion event
                        final int pointerIndex = ev.findPointerIndex(mActivePointerId);
                        final float x = ev.getX(pointerIndex);
                        final float deltaX = mLastMotionX - x;
                        mLastMotionX = x;
                        if (deltaX < 0) {
                            if (mTouchX > 0) {
                                mTouchX += Math.max(-mTouchX, deltaX);
                                mSmoothingTime = System.nanoTime() / NANOTIME_DIV;
                                invalidate();
                            }
                        } else if (deltaX > 0) {
                            final float availableToScroll = getChildAt(getChildCount() - 1).getRight()
                                    - mTouchX - getWidth();
                            if (availableToScroll > 0) {
                                mTouchX += Math.min(availableToScroll, deltaX);
                                mSmoothingTime = System.nanoTime() / NANOTIME_DIV;
                                invalidate();
                            }
                        } else {
                            awakenScrollBars();
                        }
                    }
                    break;
                case MotionEvent.ACTION_UP:
                    if (mTouchState == TOUCH_STATE_SCROLLING) {
                        final VelocityTracker velocityTracker = mVelocityTracker;
                        velocityTracker.computeCurrentVelocity(1000, mMaximumVelocity);
                        final int velocityX = (int) velocityTracker.getXVelocity(mActivePointerId);
    
                        final int screenWidth = getWidth();
                        final int whichScreen = (mScrollX + (screenWidth / 2)) / screenWidth;
                        final float scrolledPos = (float) mScrollX / screenWidth;
    
                        mChangeMotionX = mLastMotionX;
                        if (velocityX > SNAP_VELOCITY && mCurrentScreen > 0) {
                            // Fling hard enough to move left.
                            // Don't fling across more than one screen at a time.
                            final int bound = scrolledPos < whichScreen ? mCurrentScreen - 1
                                    : mCurrentScreen;
                            snapToScreen(Math.min(whichScreen, bound), velocityX, true);
                        } else if (velocityX < -SNAP_VELOCITY && mCurrentScreen < getChildCount() - 1) {
                            // Fling hard enough to move right
                            // Don't fling across more than one screen at a time.
                            final int bound = scrolledPos > whichScreen ? mCurrentScreen + 1
                                    : mCurrentScreen;
                            snapToScreen(Math.max(whichScreen, bound), velocityX, true);
                        } else {
                            snapToScreen(whichScreen, 0, true);
                        }
    
                        if (mVelocityTracker != null) {
                            mVelocityTracker.recycle();
                            mVelocityTracker = null;
                        }
                    }
                    mTouchState = TOUCH_STATE_REST;
                    mActivePointerId = INVALID_POINTER;
                    break;
                case MotionEvent.ACTION_CANCEL:
                    mTouchState = TOUCH_STATE_REST;
                    mActivePointerId = INVALID_POINTER;
                    break;
                case MotionEvent.ACTION_POINTER_UP:
                    onSecondaryPointerUp(ev);
                    break;
            }
    
            return true;
        }
    
       //修改该方法主要目的是记录滑动的距离
        @Override
        public boolean onInterceptTouchEvent(MotionEvent ev) {
            final boolean workspaceLocked = mLauncher.isWorkspaceLocked();
            final boolean allAppsVisible = mLauncher.isAllAppsVisible();
            if (workspaceLocked || allAppsVisible) {
                return false; // We don't want the events. Let them fall through to
                // the all apps view.
            }
    
            /*
             * This method JUST determines whether we want to intercept the motion.
             * If we return true, onTouchEvent will be called and we do the actual
             * scrolling there.
             */
    
            /*
             * Shortcut the most recurring case: the user is in the dragging state
             * and he is moving his finger. We want to intercept this motion.
             */
            final int action = ev.getAction();
            if ((action == MotionEvent.ACTION_MOVE) && (mTouchState != TOUCH_STATE_REST)) {
                return true;
            }
    
            if (mVelocityTracker == null) {
                mVelocityTracker = VelocityTracker.obtain();
            }
            mVelocityTracker.addMovement(ev);
    
            switch (action & MotionEvent.ACTION_MASK) {
                case MotionEvent.ACTION_MOVE: {
                    /*
                     * mIsBeingDragged == false, otherwise the shortcut would have
                     * caught it. Check whether the user has moved far enough from
                     * his original down touch.
                     */
    
                    /*
                     * Locally do absolute value. mLastMotionX is set to the y value
                     * of the down event.
                     */
                    final int pointerIndex = ev.findPointerIndex(mActivePointerId);
                    final float x = ev.getX(pointerIndex);
                    final float y = ev.getY(pointerIndex);
                    final int xDiff = (int) Math.abs(x - mLastMotionX);
                    final int yDiff = (int) Math.abs(y - mLastMotionY);
    
                    final int touchSlop = mTouchSlop;
                    boolean xMoved = xDiff > touchSlop;
                    boolean yMoved = yDiff > touchSlop;
    
                    if (xMoved || yMoved) {
    
                        if (xMoved) {
                            // Scroll if the user moved far enough along the X axis
                            mTouchState = TOUCH_STATE_SCROLLING;
                            mLastMotionX = x;
                            mTouchX = mScrollX;
                            mSmoothingTime = System.nanoTime() / NANOTIME_DIV;
                            enableChildrenCache(mCurrentScreen - 1, mCurrentScreen + 1);
                        }
                        // Either way, cancel any pending longpress
                        if (mAllowLongPress) {
                            mAllowLongPress = false;
                            // Try canceling the long press. It could also have been
                            // scheduled
                            // by a distant descendant, so use the mAllowLongPress
                            // flag to block
                            // everything
                            final View currentScreen = getChildAt(mCurrentScreen);
                            currentScreen.cancelLongPress();
                        }
                    }
                    break;
                }
    
                case MotionEvent.ACTION_DOWN: {
                    final float x = ev.getX();
                    final float y = ev.getY();
                    // Remember location of down touch
                    mLastMotionX = x;
                    mChangeMotionX = x;
                    mLastMotionY = y;
                    mActivePointerId = ev.getPointerId(0);
                    mAllowLongPress = true;
    
                    /*
                     * If being flinged and user touches the screen, initiate drag;
                     * otherwise don't. mScroller.isFinished should be false when
                     * being flinged.
                     */
                    mTouchState = mScroller.isFinished() ? TOUCH_STATE_REST : TOUCH_STATE_SCROLLING;
                    break;
                }
    
                case MotionEvent.ACTION_CANCEL:
                case MotionEvent.ACTION_UP:
                    if (mTouchState != TOUCH_STATE_SCROLLING) {
                        final CellLayout currentScreen = (CellLayout) getChildAt(mCurrentScreen);
                        if (!currentScreen.lastDownOnOccupiedCell()) {
                            getLocationOnScreen(mTempCell);
                            // Send a tap to the wallpaper if the last down was on
                            // empty space
                            final int pointerIndex = ev.findPointerIndex(mActivePointerId);
                            mWallpaperManager.sendWallpaperCommand(getWindowToken(),
                                    "android.wallpaper.tap",
                                    mTempCell[0] + (int) ev.getX(pointerIndex), mTempCell[1]
                                            + (int) ev.getY(pointerIndex), 0, null);
                        }
                    }
    
                    // Release the drag
                    clearChildrenCache();
                    mTouchState = TOUCH_STATE_REST;
                    mActivePointerId = INVALID_POINTER;
                    mAllowLongPress = false;
    
                    if (mVelocityTracker != null) {
                        mVelocityTracker.recycle();
                        mVelocityTracker = null;
                    }
    
                    break;
    
                case MotionEvent.ACTION_POINTER_UP:
                    onSecondaryPointerUp(ev);
                    break;
            }
    
            /*
             * The only time we want to intercept motion events is if we are in the
             * drag mode.
             */
            return mTouchState != TOUCH_STATE_REST;
        }

     

     

     

        这些类的修改特别是变换时一定要注意canvas的save和restore方法,不清楚的先百度一下,不然很容易就变形了。下篇讨论使用openGL实现的方法

    1 楼 zhmeup 2011-08-01  
    假的,手动拖才翻一下 根本不是真正的3D
    2 楼 ishelf 2011-08-02  
    zhmeup 写道
    假的,手动拖才翻一下 根本不是真正的3D

    这个哥们很给力,顶你一个。
    的确要做真正的3D就需要用opengl来做(GLSurfaceView),市面上有一个叫SPB的Launcher,这个是真正的3D,代价是要完全实现一套widget机制,也就是重写Launcher,你可以试试。
    3 楼 anita315 2011-11-02  
    很有幫助 ! 感謝您的提供 . 
    4 楼 zgcypjhf 2011-11-24  
    请问startRotate(canvas, currentX, canvas.getWidth(), canvas.getHeight());
    if (isCurrentScrenn && xCor < 0) { 
                xCor = width + xCor; 
                flag = false; 
            }
    变量currentX 和 isCurrentScrenn都没定义, 想请问一下是在哪定义并给它赋值的,谢谢了!
    5 楼 liu7se7en 2011-11-28  
    老大我有一个问题 就是在使用该代码实现了3D之后有个问题 就是在拖动的过程中 有时不一定出现3D效果 而且 整个屏幕发生位移
    6 楼 liu7se7en 2011-11-28  
    liu7se7en 写道
    老大我有一个问题 就是在使用该代码实现了3D之后有个问题 就是在拖动的过程中 有时不一定出现3D效果 而且 整个屏幕发生位移

    求老大指点啊
    7 楼 ishelf 2011-11-30  
    liu7se7en 写道
    liu7se7en 写道
    老大我有一个问题 就是在使用该代码实现了3D之后有个问题 就是在拖动的过程中 有时不一定出现3D效果 而且 整个屏幕发生位移

    求老大指点啊



    应该是你对canvas的操作不对,你写一个小demo测试一下,怎么平移和旋转。  尤其是旋转地中心点要确认一下在什么地方。   多打Log
    8 楼 sadsnow19840713 2011-12-02  
    对呀,有些变量没有定义和赋值,能贴得更全吗?
    9 楼 cheng330301560 2011-12-19  
    setPara方法没找到
    10 楼 jackshen118 2011-12-20  
    setPara函数是做什么用的呢?
    11 楼 烧伤的火柴 2012-02-03  
    手动拖才翻一下 根本不是真正
    12 楼 烧伤的火柴 2012-02-09  
    setPara函数是做什么用的呢?
    13 楼 ishelf 2012-02-13  
    setPara
    烧伤的火柴 写道
    setPara函数是做什么用的呢?

    你查看一下1.6的Launcher源码,这个是在1.6上开发的,早了
    14 楼 烧伤的火柴 2012-02-20  
    ishelf 写道
    setPara
    烧伤的火柴 写道
    setPara函数是做什么用的呢?

    你查看一下1.6的Launcher源码,这个是在1.6上开发的,早了

    谢谢大师指点

        
    最新技术文章:
    ▪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实现弹出键盘的方法
    ▪Android中通过view方式获取当前Activity的屏幕截...
    ▪Android提高之自定义Menu(TabMenu)实现方法
    ▪Android提高之多方向抽屉实现方法
    ▪Android提高之MediaPlayer播放网络音频的实现方法...
    ▪Android提高之MediaPlayer播放网络视频的实现方法...
    ▪Android提高之手游转电视游戏的模拟操控
     


    站内导航:


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

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

    浙ICP备11055608号-3