zoukankan      html  css  js  c++  java
  • indicator之小究

    一,源生launcher2

    源生的indicator就是idle界面最下面功能条两边的总共4个点默认workspace5屏,当前屏幕相当于一个点,代码控制:

     private Drawable mPreviousIndicator;

     private Drawable mNextIndicator;

    分别是左右两边的点集合对象,通过调用一下方法实现indicator的支援切换:

    mPreviousIndicator.setLevel(mCurrent);

    mNextIndicator.setLevel(numScreens-mCurrent-1);

    二,launcherADW

    该launcher的indicator可分为3类:

    public static final int INDICATOR_TYPE_PAGER=1;

    public static final int INDICATOR_TYPE_SLIDER_TOP=2;

    public static final int INDICATOR_TYPE_SLIDER_BOTTOM=3;

    INDICATOR_TYPE_PAGER

    是圆点形式出现在页面最上面类似于三星桌面,INDICATOR_TYPE_SLIDER_TOP和INDICATOR_TYPE_SLIDER_BOTTOM

    是样式类似于HTC分别出现在上面和下面的indicator。

     workspace中:

    用的indicator是在launcher文件里面实例化的:private DesktopIndicator mDesktopIndicator;通过里面的public方法:public DesktopIndicator getDesktopIndicator()

    得到实例进行相关的操作:mLauncher.getDesktopIndicator().indicate((float)mScroller.getCurrX()/(float)(getChildCount()*getWidth()));

    mLauncher.getDesktopIndicator().hide();

    mLauncher.getDesktopIndicator().

    show();

    AllAppSlidingView中:

    private PreviewPager mPager;

    其实是PreviewPager对indicator进行了源初始化和封装:

    if(themeResources!=null){

    resource_id=themeResources.getIdentifier ("pager_dots", "drawable", themePackage);

    }


    int dotWidth=getResources().getDrawable(mDotDrawableId).getIntrinsicWidth();

    int separation=dotWidth;

    int marginLeft=((getWidth())/2)-(((mTotalItems*dotWidth)/2)+(((mTotalItems-1)*separation)/2));

    int dotMarginTop=((getHeight())/2)-(dotWidth/2);

    然后通过方法mPager.setCurrentItem(whichScreen);来改变indicator的样式。

    :DesktopIndicator 中的三种确切的可以分为两种:PreviewPager和SliderIndicator,前者是PreviewPager的引用,后者是在DesktopIndicator 中自定义一个类来实现和封装的。

  • 相关阅读:
    Linux从入门到进阶全集——【第十四集:Shell编程】
    cmake 编译 c++ dll 的一个例子
    %1 不是有效的Win32应用程序
    C++ 生成 dll 和调用 dll 的方法实例(转)
    Clion cmake 一个简单的 C++ 程序
    一月4
    一月4日
    1月4日
    一月4日
    一月4日
  • 原文地址:https://www.cnblogs.com/aaa2832/p/2594049.html
Copyright © 2011-2022 走看看