ExpandableTextView icon indicating copy to clipboard operation
ExpandableTextView copied to clipboard

In recycleView can not work well

Open haonan1 opened this issue 9 years ago • 17 comments

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

haonan1 avatar Jun 25 '16 08:06 haonan1

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

jymycc avatar Jul 14 '16 04:07 jymycc

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

kukreja-vikramaditya avatar Jul 23 '16 11:07 kukreja-vikramaditya

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

billionbucks avatar Jul 25 '16 13:07 billionbucks

same here. How to solve it?

HolenZhou avatar Sep 19 '16 08:09 HolenZhou

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

Thank you.

Manabu-GT avatar Sep 20 '16 16:09 Manabu-GT

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

kukreja-vikramaditya avatar Oct 01 '16 03:10 kukreja-vikramaditya

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!

Studentessa avatar Jan 10 '17 11:01 Studentessa

@Studentessa Thanks,it works very good

469277027 avatar Jan 12 '17 06:01 469277027

@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
  
    ...
}

deeps2 avatar Jan 19 '17 15:01 deeps2

@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.

nangsan avatar Feb 03 '17 13:02 nangsan

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

monikagupta94 avatar Aug 01 '17 10:08 monikagupta94

@Studentessa thanks a lot,you solve my problem!

BzCoder avatar Jul 27 '18 13:07 BzCoder

@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!

aiynmm avatar Nov 26 '19 08:11 aiynmm

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

Studentessa avatar Nov 26 '19 11:11 Studentessa

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

I'm sorry, I misread it! @Studentessa

aiynmm avatar Nov 27 '19 02:11 aiynmm

@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!

aiynmm avatar Nov 27 '19 02:11 aiynmm

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.

dongxingrong avatar Dec 03 '19 10:12 dongxingrong