我在我的活动中创建了一个微调器,当我在我的Jelly Bean设备上运行我的应用时,微调器的主题就像是2.x,我怎样才能获得ICS?
这是我的微调代码:
<Spinner
android:id="@+id/spinnermap"
style="@android:style/Theme.Holo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true" />
正如您所看到的,我尝试设置全局样式“Holo”但没有结果..
NumberPicker
我遇到了同样的问题,但不记得我是如何解决它的。
答案 0 :(得分:10)
style="@android:style/Theme.Holo"
这不是解决方案。 您不会在HC设备上有后备支持。 如果你想在你的整个应用程序中使用HC +的全息主题,你需要为整个应用程序声明一个主题(我认为这是你想要的)。
在你的宣言中:
android:theme="@style/MyTheme"
值/ styles.xml:
<style name="MyTheme" parent="android:Theme.Light">
</style>
值-V11 / styles.xml:
<style name="MyTheme" parent="android:Theme.Holo.Light">
</style>
现在你将有一个关于HC +的下拉微调器(当然还有其他全息小部件)
但是,如果您只想让微调器“全息”,您可以这样做:
<Spinner
android:id="@+id/spinnermap"
style="@style/MySpinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true" />
值/ styles.xml:
<style name="MySpinner" parent="android:Widget.Spinner">
</style>
值-V11 / styles.xml:
<style name="MySpinner" parent="android:Widget.Holo.Spinner">
</style>