rance935 / sectormenu Goto Github PK
View Code? Open in Web Editor NEW一个炫酷的扇形菜单
一个炫酷的扇形菜单
你这个是什么实现思路啊?最近也看自定义View这块儿!
高斯模糊效果外部怎么调用呢
这种按钮叫做:
Floating Action Button(简称FAB)
看看可以怎么弄个名字,加上一些英文描述,可以让更多的人使用起来
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
isMove = false;
Log.e("ssss", "ACTION_DOWN");
if (checker.isQuick()) {
return false;
}
pressInButton = true;
boolean executeActionUp = !animating && buttonDatas != null && !buttonDatas.isEmpty();
if (executeActionUp) {
updatePressState(0, true);
}
////////////////////////////////////
isDrag = false;
getParent().requestDisallowInterceptTouchEvent(true);
lastX = rawX;
lastY = rawY;
ViewGroup parent;
if (getParent() != null) {
parent = (ViewGroup) getParent();
parentHeight = parent.getHeight();
parentWidth = parent.getWidth();
}
return executeActionUp;
case MotionEvent.ACTION_MOVE:
isMove = true;
Log.e("ssss", "ACTION_MOVE");
updatePressPosition(0, rawButtonRectF);
////////////////////////////////////
rawX = (int) event.getRawX();
rawY = (int) event.getRawY();
if (parentHeight <= 0 || parentWidth == 0) {
isDrag = false;
break;
} else {
isDrag = true;
}
int dx = rawX - lastX;
int dy = rawY - lastY;
//这里修复一些华为手机无法触发点击事件
int distance = (int) Math.sqrt(dx * dx + dy * dy);
if (distance == 0) {
isDrag = false;
break;
}
float x = getX() + dx;
float y = getY() + dy;
//检测是否到达边缘 左上右下
x = x < 0 ? 0 : x > parentWidth - getWidth() ? parentWidth - getWidth() : x;
y = getY() < 0 ? 0 : getY() + getHeight() > parentHeight ? parentHeight - getHeight() : y;
setX(x);
setY(y);
lastX = rawX;
lastY = rawY;
break;
case MotionEvent.ACTION_UP:
Log.e("ssss", "ACTION_UP");
// if (!isPointInRectF(pressPointF, rawButtonRectF)) {
// return true;
// }
if (isMove) {
if (maskView == null) {
maskView = new MaskView(getContext(), this);
}
if (!isNotDrag()) {
//恢复按压效果
setPressed(false);
if (rawX >= parentWidth / 2) {
//靠右吸附
animate().setInterpolator(new DecelerateInterpolator())
.setDuration(500)
.xBy(parentWidth - getWidth() - getX())
.start();
// maskView.setY(getY());
} else {
//靠左吸附
ObjectAnimator oa = ObjectAnimator.ofFloat(this, "x", getX(), 0);
oa.setInterpolator(new DecelerateInterpolator());
oa.setDuration(500);
oa.start();
}
}
updatePressPosition();
maskView.updateButtons();
maskView.invalidate();
}else {
if (maskView == null) {
maskView = new MaskView(getContext(), this);
}
updatePressState(0, false);
expand();
}
return true;
}
return super.onTouchEvent(event);
}
按钮点击展开,点击手机的返回键盘,在点击按钮,布局会乱
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.