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
private void action(StatusType type) { boolean isHide = currentLines < mLineCount; if (type != null) { mNeedAnimation = false; } if (mNeedAnimation) { ValueAnimator valueAnimator = ValueAnimator.ofFloat(0, 1); final boolean finalIsHide = isHide; valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { Float value = (Float) animation.getAnimatedValue(); if (finalIsHide) { currentLines = mLimitLines + (int) ((mLineCount - mLimitLines) * value); } else { if (mNeedContract) currentLines = mLimitLines + (int) ((mLineCount - mLimitLines) * (1 - value)); } setText(setRealContent(mContent)); } }); valueAnimator.setDuration(100); valueAnimator.start(); } else { if (isHide) { currentLines = mLimitLines + ((mLineCount - mLimitLines)); } else { if (mNeedContract) currentLines = mLimitLines; } setText(setRealContent(mContent)); } }
整个方法都没有用到type的值,只是拿去做判空操作,然后做一个开关切换。并不能切换到指定的状态。 现在我这边有一个场景是这样的,列表item中内容用到ExpandableTextview,在展开的情况下调用notifyDataItemSetChange()方法时,它自动折叠了。所以我用一个布尔值每个item的状态,在setContent后面再调用setCurrStatus。但是,就导致初始化列表数据时不是默认折叠了。
The text was updated successfully, but these errors were encountered:
请问你解决了吗?我想用这个方法设置点击内容收起展开,但压根设置了没用
Sorry, something went wrong.
/** * 设置当前的状态 * * @param type */ public void setCurrStatus(StatusType type) { action(type); } ExpandableTextView中有一个方法可以展开或收起 前提是你没有设置bind 也就是列表中保存展开或收起状态 /** * 绑定状态 * * @param model */ public void bind(ExpandableStatusFix model) { mModel = model; } 解决方法 在自己代码需要展开或者收起的地方设置状态(ps:状态是反的) 如果想打开: model.setStatus(StatusType.STATUS_CONTRACT); expandableTextView.setCurrStatus(entity.getStatus()); 如果想收起: model.setStatus(StatusType.STATUS_EXPAND); expandableTextView.setCurrStatus(entity.getStatus());
/** * 设置当前的状态 * * @param type */ public void setCurrStatus(StatusType type) { action(type); }
/** * 绑定状态 * * @param model */ public void bind(ExpandableStatusFix model) { mModel = model; }
model.setStatus(StatusType.STATUS_CONTRACT); expandableTextView.setCurrStatus(entity.getStatus());
model.setStatus(StatusType.STATUS_EXPAND); expandableTextView.setCurrStatus(entity.getStatus());
No branches or pull requests
整个方法都没有用到type的值,只是拿去做判空操作,然后做一个开关切换。并不能切换到指定的状态。
现在我这边有一个场景是这样的,列表item中内容用到ExpandableTextview,在展开的情况下调用notifyDataItemSetChange()方法时,它自动折叠了。所以我用一个布尔值每个item的状态,在setContent后面再调用setCurrStatus。但是,就导致初始化列表数据时不是默认折叠了。
The text was updated successfully, but these errors were encountered: