문제

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