We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
如题,考虑可能是子View的Z轴排列问题,我自己fork之后做了修改,目前我的解决办法是在TagCloudView的onLayout中用child.bringToFront();控制Z轴排序。但可能性能上会有问题,希望能有更好的解决方法:) TagCloudView
TagCloudView
onLayout
child.bringToFront();
@Override protected void onLayout(boolean changed, int l, int t, int r, int b) { left = l; right = r; top = t; bottom = b; Collections.sort(tags, new SortByScale()); for (int i=0;i<tags.size();i++){ Tag tag=tags.get(i); View child =tag.getChildView(); if (child!=null&&child.getVisibility() != GONE) { child.setScaleX(tag.getScale()); child.setScaleY(tag.getScale()); child.setAlpha(tag.getAlpha()); int left, top; left = (int) (centerX + tag.getLoc2DX()) - child.getMeasuredWidth() / 2; top = (int) (centerY + tag.getLoc2DY()) - child.getMeasuredHeight() / 2; child.layout(left, top, left + child.getMeasuredWidth(), top + child.getMeasuredHeight()); child.bringToFront(); } }
SortByScale
class SortByScale implements Comparator { public int compare(Object o1, Object o2) { if(o1 instanceof Tag && o2 instanceof Tag){ return ((Tag) o1).getScale()>((Tag) o2).getScale()?1:-1; } return 0; } }
The text was updated successfully, but these errors were encountered:
诚然,现在所有的tag都绘制在同一个layer上,如你这样依据scale为tag分层是一个不错的思路,提交一个pull request吧~
Sorry, something went wrong.
Merge pull request #9 from MidoriInu1/master
cb5c866
fix Issues #8
Using compile 'com.moxun:tagcloudlib:1.2.0' instead the old library
compile 'com.moxun:tagcloudlib:1.2.0'
No branches or pull requests
如题,考虑可能是子View的Z轴排列问题,我自己fork之后做了修改,目前我的解决办法是在
TagCloudView
的onLayout
中用child.bringToFront();
控制Z轴排序。但可能性能上会有问题,希望能有更好的解决方法:)TagCloudView
SortByScale
The text was updated successfully, but these errors were encountered: