Skip to content
This repository has been archived by the owner on Jun 9, 2020. It is now read-only.

if section pinned view is not TextView will has show problem #27

Open
wszyquan opened this issue Nov 18, 2013 · 5 comments
Open

if section pinned view is not TextView will has show problem #27

wszyquan opened this issue Nov 18, 2013 · 5 comments

Comments

@wszyquan
Copy link

I try in adapter getView return LinearLayout ,in this LinearLayout contain ImageView and TextView ,if not scroll, the section pinned item is right, but when i scroll the pinned item's TextView's text don't show , I try to changle when it is pinned Section ,when is pinned Section I return TextView and set text content, It is ok.

I hope the pinned section header can be other View not only TextView

@miloisbadboy
Copy link

i got the same problem

@shimitapiro
Copy link

Any solution found ?

@seefutureLee
Copy link

i got the same problem when i set gravity center in textview

@UnderTheMoonspell
Copy link

I think my problem is the same. In my getView from the adapter I inflate a layout where I have a textview inside a LinearLayout. In my vanilla listview everything worked fine, except the section row would not stick to top.

After implementing the pinnedlistview, the pinned section, instead of mantaining the row size it previously had (defined by the LinearLayout surrounding the TextView), would cut the row height (compairing with the example provided here, I noticed that this new height appeared after pinnedView.measure(ws, hs); inside createPinnedShadow). After some debugging and a bit of luck, I found that if in my TextView I changed the heigh from wrap_content to a fixed height everything worked fine. I am not sure why this occurs since the LinearLayout surrounding the textview has that same fixed height...

Anyway it solved my problem

@tankery
Copy link

tankery commented Nov 5, 2015

When I dig into the library, I found out that if the section is a Layout, its position of Y will changed to negative when scroll over top. So we can not see this section when draw.

I'm not digging further after this, so I just apply a quick & dirty fix to my project to fix this issue.

That is, translate the canvas in dispatchDraw, and offset the mTouchRect in isPinnedViewTouched, the code is showing below:

canvas.translate(pLeft, pTop + mTranslateY);
->
canvas.translate(pLeft, pTop + mTranslateY - view.getY());

...

view.getHitRect(mTouchRect);
->
view.getHitRect(mTouchRect);
mTouchRect.offset(0, Math.round(-view.getY()));

Hope the author or anyone else can fix the root cause of this issue. And before that, hope this solution can help you.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants