You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Incase of large text, the text isn't shown completely in expanded state. This is still a bug in the latest version of this repository as of today and needs to be fixed in the next release @Manabu-GT . For now, following is the solution explained clearly.
SOLUTION
In ExpandableTextView class, in the onMeasure method: Cut the line
Or for ease, you can directly replace your onMeasure method with the method below.
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
// If no change, measure and returnif (!mRelayout || getVisibility() ==View.GONE) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
return;
}
mRelayout =false;
// Setup with optimistic case// i.e. Everything fits. No button needed
mToggleView.setVisibility(View.GONE);
mTv.setMaxLines(Integer.MAX_VALUE);
// Measuresuper.onMeasure(widthMeasureSpec, heightMeasureSpec);
//--- Previously the mTextHeightWithMaxLines was initialized here ---// // If the text fits in collapsed mode, we are done.if (mTv.getLineCount() <= mMaxCollapsedLines) {
return;
}
// Doesn't fit in collapsed mode. Collapse text view as needed. Show// button.if (mCollapsed) {
mTv.setMaxLines(mMaxCollapsedLines);
}
mToggleView.setVisibility(View.VISIBLE);
// Re-measure with new setupsuper.onMeasure(widthMeasureSpec, heightMeasureSpec);
mTextHeightWithMaxLines = getRealTextViewHeight(mTv);
if (mCollapsed) {
// Gets the margin between the TextView's bottom and the ViewGroup's bottom
mTv.post(new Runnable() {
@Override
public void run() {
mMarginBetweenTxtAndBottom = getHeight() - mTv.getHeight();
}
});
// Saves the collapsed height of this ViewGroup
mCollapsedHeight = getMeasuredHeight();
}
}
This was also discussed in this issue here #5 but the solution wasn't explained clearly.
The text was updated successfully, but these errors were encountered:
Some of the library versions used in the original repository are outdated now. I had to clone this repository and update the versions especially the annotation libraries like
import android.support.annotation.DrawableRes;
with the AndroidX ones:
import androidx.annotation.DrawableRes;
Some libraries used in the build.gradle file were also updated. Therefore, after these modifications, I had to include this as a new module in the project since its now a customized library.
If I get some time then I will try to fork this project, update the libraries and generate the PR but I am quite occupied by work these days. It would be great if you or someone else could do the needful.
dimskiy
added a commit
to dimskiy/ExpandableTextView_fork
that referenced
this issue
Apr 13, 2022
Incase of large text, the text isn't shown completely in expanded state. This is still a bug in the latest version of this repository as of today and needs to be fixed in the next release @Manabu-GT . For now, following is the solution explained clearly.
SOLUTION
In ExpandableTextView class, in the onMeasure method: Cut the line
and paste it right below this line
Or for ease, you can directly replace your onMeasure method with the method below.
This was also discussed in this issue here #5 but the solution wasn't explained clearly.
The text was updated successfully, but these errors were encountered: