Manabu-GT / ExpandableTextView

Android's TextView that can expand/collapse like the Google Play's app description
Apache License 2.0
4.08k stars 791 forks source link

In recycleView can not work well #44

Open haonan1 opened 8 years ago

haonan1 commented 8 years ago

In a RecyclerView i have other view, if the TextView is expanded and you scroll,the other view in some item has gone please give me some suggestion

jymycc commented 8 years ago

have you fixed that ? i got the same problem: (

kukreja-vikramaditya commented 8 years ago

Yes same here. Can you create a expand() and collapse() method?

billionbucks commented 8 years ago

@kukreja-vikramaditya @jymycc @haonan1 seems like setting the visibility gone and then Visible at OnBindViewHolder will fix it , (working for me)

HolenZhou commented 7 years ago

same here. How to solve it?

Manabu-GT commented 7 years ago

If anyone can share sample code which reproduces what you are experiencing, I can take a look this weekend.

Thank you.

kukreja-vikramaditya commented 7 years ago

I don't think it is a problem with library, could you guys check if your 'position' or 'holder' has the keyword 'final' before it? @billionbucks @HolenZhou @Manabu-GT @jymycc @haonan1

Studentessa commented 7 years ago

hello every body! I'm getting the same problem, I have tried using @billionbucks trick but it doesn't work. I'm not using final variables @kukreja-vikramaditya ! thanks in advance!

EDIT I was using the wrong method! setText(@Nullable CharSequence text) Using this one: setText(@Nullable CharSequence text, @NonNull SparseBooleanArray collapsedStatus, int position) works good!

please modify the wiky!

469277027 commented 7 years ago

@Studentessa Thanks,it works very good

deeps2 commented 7 years ago

@Studentessa thanks, it works :-)

onBindViewHolder(ViewHolder holder, final int pos) {
      ....
       SparseBooleanArray mTogglePositions = new SparseBooleanArray();

      // setText(@Nullable CharSequence text, @NonNull SparseBooleanArray collapsedStatus, int pos)
       holder.newsDescription.setText(listOfArticles.get(position).getDescription(), mTogglePositions , pos); 
      //where newsDescription is my TextView

     ...
}
nangsan commented 7 years ago

@deeps2 your solution was right, but it has some flaw initialize the SparseBooleanArray while creating RecyclerView adapter and pass it to the setText method. That should do it.

monikagupta94 commented 7 years ago

@Studentessa Thank you. It worked but also need to change animation 0 if content is enough long.

BzCoder commented 6 years ago

@Studentessa thanks a lot,you solve my problem!

aiynmm commented 4 years ago

@Studentessa What's your mean about what you said that need to change animation 0 if content is enough long? I have a problem when collaping the text if content is enough long!

Studentessa commented 4 years ago

@aiynmm what your'asking was refered by @monikagupta94 , maybe he can answer you. =D

aiynmm commented 4 years ago

@aiynmm what your'asking was refered by @monikagupta94 , maybe he can answer you. =D

I'm sorry, I misread it! @Studentessa

aiynmm commented 4 years ago

@Studentessa Thank you. It worked but also need to change animation 0 if content is enough long.

@monikagupta94 Could you tell me what should I do to solve this problem!

dongxingrong commented 4 years ago

Solution: while using in recyclerview, use SpareIntArray to record mMarginBetweenTxtAndBottom and mCollapsedHeight, and reuse them when ExpandableTextView's init value is 0. Reuse items in reycleview cause this problem.