开发者

How to show progress indicator or progress Bar in the titleBar in android?

I have an http request and some UI change during that time and I want to show the activity indicator during that time . I want to show it in the title bar. I want to show progress indicator 开发者_如何学编程in the title in android like activity indicator in iphone?


From your activity code:

getWindow().requestFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
...
// when you need to show progress:
setProgressBarIndeterminate([true|false]);


Yes, above two/three lines need to be used in following way.

1) Need to add this before calling setContentView() method.

getWindow().requestFeature(Window.FEATURE_INDETERMINATE_PROGRESS);

2) Need to add this after calling setContentView() method.

setProgressBarIndeterminateVisibility(true);

To stop the progress indicator

setProgressBarIndeterminateVisibility(false);

If we start showing progress from a parent activity and closing from a child activity,

ParentActivity parent = (ParentActivity)getParent();
parent.setProgressBarIndeterminateVisibility(false);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜