Android: AmazingListView Pinned Header - Untouchable

I have a project that uses AmazingListView:

https://code.google.com/p/android-amazing-listview/

I need a button in the pinned header. However, it seems that the header title for some reason cannot receive any touch events. What do I need to get this button pressed? Is there a way to intercept events and send them to the header?

Thanks!

+4
source share
2 answers

I have the same problem with this component. In my case, the pinned header is a relativelayout that has a button that I need to use. The real problem is how the added title is added to the list. It is "drawn" and not added to the list hierarchy:

@Override protected void dispatchDraw(Canvas canvas) { super.dispatchDraw(canvas); if (mHeaderViewVisible) { drawChild(canvas, mHeaderView, getDrawingTime()); } } 

mHeaderView is never added to hierachy view ...

I do not know if it is possible to view views that are "rendered" to receive any user input.

Perhaps we need to develop a way to implement the pinned header by adding it to the hierachy views ...

+3
source

Yes, you can, you will need to override some methods in the AmazingAdapter, if I remember correctly, by default these views are considered as not allowed. See ListAdapter and its methods: http://developer.android.com/reference/android/widget/ListAdapter.html

So, in theory (I did not deeply study the code for AmazingListView), you should return true for these elements or just return true for all.

0
source

Source: https://habr.com/ru/post/1497088/


All Articles