Launcher3源码分析(CellLayout)

本文深入剖析了Launcher3中的CellLayout,它是workspace屏幕的核心。探讨了CellLayout的重要属性,如构造方法,以及如何在Workspace.java中加载布局。此外,还讲解了CellInfo如何记录每个item的坐标和占据的单元格数量,以及CellLayout如何处理触摸事件和设置cell间距与大小。
摘要由CSDN通过智能技术生成

CellLayout是workspace的屏幕。
CellLayout中的一些重要属性:

int mCellWidth;
int mCellHeight;
//每一个屏幕的行列数
int mCountX;//每一行的item个数
int mCountY;//每一列的item个数
//item之间的距离
int mWidthGap;//item之间的宽度
int mHeightGap;//item之间的高度

构造方法

public CellLayout(Context context, AttributeSet attrs, int defStyle){
    super(context,attrs,defStyle){
        setWillNotDraw(false);
        setClipToPadding(false);
        mLauncher = (Launcher)context;

        DeviceProfile grid = mLauncher.getDeviceProfile();
        TypedArray a = context.obtainStyledAttributes(attrs,R.styleable.CellLayout,defStyle,0<
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值