Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

offLineWidth的初始化修改,解决初始显示的填充颜色问题 #37

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion ToggleButtonLib/src/com/zcw/togglebutton/ToggleButton.java
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,9 @@ protected void onLayout(boolean changed, int left, int top, int right,
spotMaxX = endX - borderWidth;
spotSize = height - 4 * borderWidth;
spotX = toggleOn ? spotMaxX : spotMinX;
offLineWidth = 0;
// fix:这里应该初始化为spotSize而不是0。否则会导致初始显示默认为off时,填充颜色为offBorderColor,
// 第一次点击时中间区域突变为白色(offColor),然后才随着spot右移范围变小
offLineWidth = spotSize;
}


Expand Down