Fragment loading spinner/dialog in Honeycomb

别等时光非礼了梦想. 提交于 2019-12-20 10:14:22

问题


When loading data into my Fragments I would would like to have an indeterminate spinner in the middle of the fragment (example in pic below) to show the user that content is loading within that particular pane.

What's the best way to do this in Honeycomb?

I don't really want to use a spinner in the action bar, it's not immediately obvious where data is loading. Also, I don't want an indeterminate progress dialog because it appears in the center of the entire app and also stops the user from doing anything else until it is dismissed. N.B. FragmentDialogs seem to do this also.

Am I going to have to hack around with a custom FrameLayout to get the desired effect for each pane?


回答1:


If you're using a ListFragment you can call setListShown(false) to display a loading progress indicator until you call setListShown(true). You can call these in the fragment's Loader callback methods to show the indicator while the list is loading.




回答2:


I think the best way to accomplish this would be to use a ViewSwitcher. Then if you are using a loader, you can just switch between the views (the loading view and the content view) after the load has been completed.



来源:https://stackoverflow.com/questions/5318175/fragment-loading-spinner-dialog-in-honeycomb

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!