我试图把一个不确定的进度条上的动作条。我用的而ActionView放像Google+应用,例如进度。
<项目
机器人:ID =@ + ID / menu_progress
机器人:actionLayout =@布局/ action_progress
机器人:menuCategory =容器
机器人:showAsAction =总是>
< /项目>
问题是,进度条被认为是一个项目,因此在Nexus S的人像模式我只有一个在动作条其他项目,而在Google+上,我可以看到两个项目加上进度。 这怎么可能使用Android的动作条放一个进度?
解决方案注意:下面的功能现在pcated在支持库德$ P $。
您需要调用
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS)
在的onCreate()
设置活动的布局之前:
例如。
@覆盖
保护无效的onCreate(包savedInstanceState){
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
... //设置布局等
如果您使用的是支持库替换< STRONG> requestWindowFeature 是 supportRequestWindowFeature 的
然后调用
setProgressBarIndeterminateVisibility(真正的);
您的活动,只要你想显示进度微调。
I am trying to put an indeterminate ProgressBar on the actionBar. I was using an actionView to put the progressBar like Google+ app for example.
<item
android:id="@+id/menu_progress"
android:actionLayout="@layout/action_progress"
android:menuCategory="container"
android:showAsAction="always">
</item>
the problem is that the progress bar is considered as an item and therefore on a Nexus S portrait mode I have only one other item on the actionbar while on Google+ I can see two items plus the progressBar. How is it possible to put a progressbar using the android actionbar?
解决方案NOTE: The functionality below is now deprecated in the Support Library.
You need to call
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS)
in your onCreate()
before setting the activity's layout:
e.g.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
... // set layout etc
If you are using the support library replace requestWindowFeature with supportRequestWindowFeature
And then call
setProgressBarIndeterminateVisibility(true);
on your Activity whenever you want to show the progress spinner.
相关推荐
最新文章