| AndBase开发框架 1.6

- 首页
- 相关页面
- 命名空间
- 类
- 文件

- 类列表
- 类索引
- 类继承关系
- 类成员

全部 类 命名空间 文件 函数 变量 枚举值 页
Public 成员函数 | Protected 成员函数 | Private 成员函数 | Private 属性 | 所有成员列表
com.ab.view.sliding.AbSlidingButton类 参考
类 com.ab.view.sliding.AbSlidingButton 继承关系图:

## Public 成员函数
| AbSlidingButton (Context context)
| AbSlidingButton (Context context, AttributeSet attrs)
void | setImageResource (int btnBottomResource, int btnFrameResource, int btnMaskResource, int btnNormalResource, int btnPressedResource)
boolean | isChecked ()
void | setChecked (boolean checked)
void | setChecked (boolean checked, boolean anim)
void | setOnCheckedChangeListener (OnCheckedChangeListener listener)
boolean | onTouchEvent (MotionEvent event)
boolean | performClick ()
void | toggle ()

## Protected 成员函数
void | onDraw (Canvas canvas)
void | onMeasure (int paramInt1, int paramInt2)

## Private 成员函数
void | init (Context context)
float | getRealPos (float paramFloat)
void | moveView (float pos)
void | moveView (final float pos, boolean delay)
void | startAnimation ()
void | moveViewToTarget ()

## Private 属性
Context | context
Bitmap | btnFrame
Bitmap | btnMask
Bitmap | btnBottom
Bitmap | mBtnNormal
Bitmap | mBtnPressed
OnCheckedChangeListener | onCheckedChangeListener
boolean | isChecked
float | mMaskHeight
float | mMaskWidth
float | mBtnOffPos
float | mBtnOnPos
float | mBtnPos
float | mLastBtnPos
float | mRealPos
float | mBtnWidth
float | mExtendOffsetY
int | mAlpha
Paint | mPaint
PorterDuffXfermode | mXfermode
RectF | mSaveLayerRectF
Bitmap | mCurBtnPic
float | mFirstDownX
boolean | mMoveEvent
boolean | mAnimating
float | mAnimationPosition
float | mAnimatedVelocity
Handler | handler

## 详细描述

© 2012 amsoft.cn 名称：AbSlidingButton.java 描述：滑动按钮

作者
  还如一梦中

版本
  v1.0

日期
  ：2013-11-14 上午11:31:21

## 构造及析构函数说明

com.ab.view.sliding.AbSlidingButton.AbSlidingButton | ( | Context | context | ) |
| inline

Instantiates a new ab sliding button.

参数

  context | the context

com.ab.view.sliding.AbSlidingButton.AbSlidingButton | ( | Context | context,
|  | AttributeSet | attrs
| ) |  |
| inline

Instantiates a new ab sliding button.

参数

  context | the context
  attrs | the attrs

## 成员函数说明

float com.ab.view.sliding.AbSlidingButton.getRealPos | ( | float | paramFloat | ) |
| inline private

Gets the real pos.

参数

  paramFloat | the param float

返回
  the real pos

void com.ab.view.sliding.AbSlidingButton.init | ( | Context | context | ) |
| inline private

Inits the.

参数

  context | the context

boolean com.ab.view.sliding.AbSlidingButton.isChecked | ( |  | ) |
| inline

描述：获得当前.

版本
  v1.0

返回
  true, if is checked

参见
  android.widget.CompoundButton::isChecked()

作者
  : amsoft.cn

日期
  ：2013-11-29 下午3:54:47

void com.ab.view.sliding.AbSlidingButton.moveView | ( | float | pos | ) |
| inline private

描述：滑块移动.

版本
  v1.0

参数

  pos | the pos

日期
  ：2013-12-5 上午11:46:56

void com.ab.view.sliding.AbSlidingButton.moveView | ( | final float | pos,
|  | boolean | delay
| ) |  |
| inline private

描述：滑块移动.

版本
  v1.0

参数

  pos | the pos
  delay | the delay

日期
  ：2013-12-5 上午11:46:56

void com.ab.view.sliding.AbSlidingButton.moveViewToTarget | ( |  | ) |
| inline private

描述：直接移动到位置.

版本
  v1.0

日期
  ：2013-12-9 上午9:20:38

void com.ab.view.sliding.AbSlidingButton.onDraw | ( | Canvas | canvas | ) |
| inline protected

void com.ab.view.sliding.AbSlidingButton.onMeasure | ( | int | paramInt1,
|  | int | paramInt2
| ) |  |
| inline protected

描述：测量View的宽高.

参数

  paramInt1 | the param int1
  paramInt2 | the param int2

参见
  android.view.View::onMeasure(int, int)

boolean com.ab.view.sliding.AbSlidingButton.onTouchEvent | ( | MotionEvent | event | ) |
| inline

描述：滑动事件.

版本
  v1.0

参数

  event | the event

返回
  true, if successful

参见
  android.widget.TextView::onTouchEvent(android.view.MotionEvent)

作者
  : amsoft.cn

日期
  ：2013-12-5 上午11:22:12

boolean com.ab.view.sliding.AbSlidingButton.performClick | ( |  | ) |
| inline

void com.ab.view.sliding.AbSlidingButton.setChecked | ( | boolean | checked | ) |
| inline

描述：设置选中.

版本
  v1.0

参数

  checked | the new checked

参见
  android.widget.CompoundButton::setChecked(boolean)

作者
  : amsoft.cn

日期
  ：2013-11-29 下午3:54:33

void com.ab.view.sliding.AbSlidingButton.setChecked | ( | boolean | checked,
|  | boolean | anim
| ) |  |
| inline

描述：设置选中.

版本
  v1.0

参数

  checked | the checked
  anim | the anim

参见
  android.widget.CompoundButton::setChecked(boolean)

作者
  : amsoft.cn

日期
  ：2013-11-29 下午3:54:33

void com.ab.view.sliding.AbSlidingButton.setImageResource | ( | int | btnBottomResource,
|  | int | btnFrameResource,
|  | int | btnMaskResource,
|  | int | btnNormalResource,
|  | int | btnPressedResource
| ) |  |
| inline

描述：设置图片资源.

版本
  v1.0

参数

  btnBottomResource | the btn bottom resource
  btnFrameResource | the btn frame resource
  btnMaskResource | the btn mask resource
  btnNormalResource | the btn normal resource
  btnPressedResource | the btn pressed resource

日期
  ：2013-11-29 下午3:26:42

void com.ab.view.sliding.AbSlidingButton.setOnCheckedChangeListener | ( | OnCheckedChangeListener | listener | ) |
| inline

描述：设置监听器.

版本
  v1.0

参数

  listener | the new on checked change listener

参见
  android.widget.CompoundButton::setOnCheckedChangeListener(android.widget.CompoundButton.OnCheckedChangeListener)

作者
  : amsoft.cn

日期
  ：2013-11-29 下午3:54:20

void com.ab.view.sliding.AbSlidingButton.startAnimation | ( |  | ) |
| inline private

描述：用位移加速度实现动画.

版本
  v1.0

日期
  ：2013-12-9 上午9:47:59

void com.ab.view.sliding.AbSlidingButton.toggle | ( |  | ) |
| inline

## 类成员变量说明

Bitmap com.ab.view.sliding.AbSlidingButton.btnBottom
| private

The btn bottom.

Bitmap com.ab.view.sliding.AbSlidingButton.btnFrame
| private

The btn frame.

Bitmap com.ab.view.sliding.AbSlidingButton.btnMask
| private

The btn mask.

Context com.ab.view.sliding.AbSlidingButton.context
| private

The context.

Handler com.ab.view.sliding.AbSlidingButton.handler
| private

初始值:
= new Handler() {
@Override
public void handleMessage(Message msg) {
switch (msg.what) {
case 0:
mRealPos = getRealPos((Float)msg.obj);
mLastBtnPos = (Float)msg.obj;
invalidate();
break;
default:
break;
}
}
}

The handler.

boolean com.ab.view.sliding.AbSlidingButton.isChecked
| private

The is checked.

int com.ab.view.sliding.AbSlidingButton.mAlpha
| private

The m alpha.

float com.ab.view.sliding.AbSlidingButton.mAnimatedVelocity
| private

The m animated velocity.

boolean com.ab.view.sliding.AbSlidingButton.mAnimating
| private

The m animating.

float com.ab.view.sliding.AbSlidingButton.mAnimationPosition
| private

The m animation position.

Bitmap com.ab.view.sliding.AbSlidingButton.mBtnNormal
| private

The m btn normal.

float com.ab.view.sliding.AbSlidingButton.mBtnOffPos
| private

The m btn off pos.

float com.ab.view.sliding.AbSlidingButton.mBtnOnPos
| private

The m btn on pos.

float com.ab.view.sliding.AbSlidingButton.mBtnPos
| private

The m btn pos.

Bitmap com.ab.view.sliding.AbSlidingButton.mBtnPressed
| private

The m btn pressed.

float com.ab.view.sliding.AbSlidingButton.mBtnWidth
| private

The m btn width.

Bitmap com.ab.view.sliding.AbSlidingButton.mCurBtnPic
| private

The m cur btn pic.

float com.ab.view.sliding.AbSlidingButton.mExtendOffsetY
| private

The m extend offset y.

float com.ab.view.sliding.AbSlidingButton.mFirstDownX
| private

The m first down x.

float com.ab.view.sliding.AbSlidingButton.mLastBtnPos
| private

The m last btn pos.

float com.ab.view.sliding.AbSlidingButton.mMaskHeight
| private

The m mask height.

float com.ab.view.sliding.AbSlidingButton.mMaskWidth
| private

The m mask width.

boolean com.ab.view.sliding.AbSlidingButton.mMoveEvent
| private

The m move event.

Paint com.ab.view.sliding.AbSlidingButton.mPaint
| private

The m paint.

float com.ab.view.sliding.AbSlidingButton.mRealPos
| private

The m real pos.

RectF com.ab.view.sliding.AbSlidingButton.mSaveLayerRectF
| private

The m save layer rect f.

PorterDuffXfermode com.ab.view.sliding.AbSlidingButton.mXfermode
| private

The m xfermode.

OnCheckedChangeListener com.ab.view.sliding.AbSlidingButton.onCheckedChangeListener
| private

The on checked change listener.

该类的文档由以下文件生成:

- src/com/ab/view/sliding/AbSlidingButton.java