java 如何展示全息主题的活动圈?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12316365/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How can I display a holo-themed activity circle?
提问by Mridang Agarwalla
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?
我的圈子看起来不像您在 Gmail 应用或 Play 应用中看到的 Holo 主题圈。我究竟做错了什么?如何获得漂亮的 Holo 动画活动圈?
回答by Mridang Agarwalla
回答by vault
Your first layout was right but you chose the wrong style. The right one is:
您的第一个布局是正确的,但您选择了错误的样式。正确的是:
style="@android:style/Widget.Holo.Light.ProgressBar.Large"
回答by CNorris
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.
你用的是什么版本的安卓?如果您没有使用 Holo 的版本,您将无法使用 Holo 样式显示内容。一个解决方案是使用像 ActionBarSherlock 这样的库,它将 Holo 主题向后移植到以前的 Android 版本。