سؤال

I've implemented ChrisBanes' pull-to-refresh using a Stock Action Bar.

However, after the pull, the "Loading..." message appears and covers all my action bar buttons. This is great, and what I expect. However, if I touch the action bar where I know the buttons normally are, they behave just as if the buttons were there.

How can I get the 'loading...' actionbar header to consume all touch events?

هل كانت مفيدة؟

المحلول

How can I get the 'loading...' actionbar header to consume all touch events?

The reason it doesn't to begin with is due to how the View is added to the Window. When PullToRefreshAttacher creates the WindowManager.LayoutParams used for calling WindowManager.addView(View, LayoutParams), it uses the flag:

WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE

Which as per the docs indicates:

Window flag: this window can never receive touch events.

So, if you want the header view to consume touch events, you'll have to modify the PullToRefreshAttacher and remove this flag.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top