SwipeMenuLayout.java 文件源码

java
阅读 28 收藏 0 点赞 0 评论 0

项目:AppFirCloud 作者:
private void init(Context context, AttributeSet attrs, int defStyleAttr) {
    mScaleTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
    mMaxVelocity = ViewConfiguration.get(context).getScaledMaximumFlingVelocity();
    //初始化滑动帮助类对象
    //mScroller = new Scroller(context);

    //右滑删除功能的开关,默认开
    isSwipeEnable = true;
    //IOS、QQ式交互,默认开
    isIos = true;
    //左滑右滑的开关,默认左滑打开菜单
    isLeftSwipe = true;
    TypedArray ta = context.getTheme().obtainStyledAttributes(attrs, R.styleable.SwipeMenuLayout, defStyleAttr, 0);
    int count = ta.getIndexCount();
    for (int i = 0; i < count; i++) {
        int attr = ta.getIndex(i);
        //如果引用成AndroidLib 资源都不是常量,无法使用switch case
        if (attr == R.styleable.SwipeMenuLayout_swipeEnable) {
            isSwipeEnable = ta.getBoolean(attr, true);
        } else if (attr == R.styleable.SwipeMenuLayout_ios) {
            isIos = ta.getBoolean(attr, true);
        } else if (attr == R.styleable.SwipeMenuLayout_leftSwipe) {
            isLeftSwipe = ta.getBoolean(attr, true);
        }
    }
    ta.recycle();


}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号