How can I display a holo-themed activity circle?

孤者浪人 提交于 2019-11-28 18:39:07

问题


I've tried to show an indeterminate activity circle like this one:

Here's the layout code:

<ProgressBar
    android:id="@+id/progress"
    style="@style/GenericProgressIndicator"
    android:layout_width="wrap_content"
    android:layout_height="fill_parent"
    android:layout_gravity="center_vertical|center_horizontal"
    android:visibility="gone" />

Here's the styling code:

<style name="GenericProgressIndicator" parent="@android:style/Widget.ProgressBar.Large">
    <item name="android:layout_width">wrap_content</item>
    <item name="android:layout_height">wrap_content</item>
    <item name="android:indeterminate">true</item>
</style>

My circle doesn't look anything like the Holo themed circle that you see in the Gmail App or the Play app. What am I doing wrong? How can I get the nice Holo animated activity circle?


回答1:


This really wasn't documented anywhere and I found it through some random article. Adding this styling attribute does the trick:

style="?android:attr/progressBarStyleLarge"

The only reference to this on the developer documentation is here.




回答2:


Your first layout was right but you chose the wrong style. The right one is:

style="@android:style/Widget.Holo.Light.ProgressBar.Large"



回答3:


What version of Android are you using? If you're not using a version with Holo, you won't be able to display things using the Holo style. A solution to that is to use a library like ActionBarSherlock, which backports the Holo theme to previous Android versions.



来源:https://stackoverflow.com/questions/12316365/how-can-i-display-a-holo-themed-activity-circle

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