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 中自定义一个类来实现和封装的。

framework的jar文件为out\target\common\obj\JAVA_LIBRARIES\framework_intermediates\classes.jar。


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值