Comments (5)
The fix is in v0.1.1 and now published to the maven central.
It should go live within a day.
Thank you for you guys's help.
Manabu
from expandabletextview.
I didn't originally intend this to be used within a ListView where the view gets recycled.
However, I believe you could try the following method to reset the collapsed state within your ListView.
(I never tested it, so it might not work.)
Reset the ExpandableTextView's height to its original value within your getView() method inside your adapter, then call setText() and requestLayout().
from expandabletextview.
I also use it in listview, I solved this problem, maybe it have some bugs.
-
first add two members:
// when in listview , use this map to save collapsed status
private SparseArrayCompat mConvertTextCollapsedStatus = new SparseArrayCompat();
private int mPosition; -
add a method:
public void setConvertText(int position,String text) { boolean isCollapsed = mConvertTextCollapsedStatus.get(position, true); mPosition = position; clearAnimation(); mCollapsed = isCollapsed; if (mButton != null) { mButton.setImageDrawable(mCollapsed ? mExpandDrawable : mCollapseDrawable); } clearAnimation(); if (mCollapsed) { if (mTv!=null){ mTv.setMaxLines(mMaxCollapsedLines); } } else { if (mTv!=null) { mTv.setMaxLines(Integer.MAX_VALUE); } } this.getLayoutParams().height = android.view.ViewGroup.LayoutParams.WRAP_CONTENT; setText(text); requestLayout();
}
-
in onClick Method, add
mCollapsed = !mCollapsed; mConvertTextCollapsedStatus.put(mPosition, mCollapsed);
I have test it , it works in listview.
I will commit it to github next time
from expandabletextview.
I have commit it to github, hope it can help you.
https://github.com/com314159/ExpandableTextViewInListView/tree/master
from expandabletextview.
I have fix some bugs in listview, you can see the commit in the github.
Thank you Manabu-GT
from expandabletextview.
Related Issues (20)
- TextView 内容足够长,超出一屏, mCollapsedHeight计算的有问题 HOT 7
- 和recyclerview配合一起使用的时候下拉刷新
- mCollapsedHeight always 0 , when click to close the ExpandView
- i set spannablestring in the text,it works error in recycleview when i collapse the it HOT 2
- shit
- How to hide the image button and create custom button? HOT 1
- Write the widget in xml ,but show nothing in screen.Anything wrong? HOT 5
- 内容显示不全
- In the recyclerview, the expansion does not display the entire content correctly. HOT 4
- Can not works with androidx in android 3.3 version and gradle version 3.3.0
- AndroidX
- There is no support for collapsing an already expanded textview. HOT 1
- I cannot add three dots while ExpandableTextView is Collapsed
- Not Compatible with AndroidX (Empty screen) HOT 1
- MaxLines on expanded TextView?
- How to set custom expand/collapse ImageButtons src? HOT 1
- Duplicate Issue Created by Mistake | GitHub Bug -.- | IGNORE
- Duplicate Issue Created by Mistake | GitHub Bug -.- | IGNORE
- Solution for "Text is not completely shown in Expanded State (Height Calculation Issue)" HOT 2
- Support for Android X
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from expandabletextview.