[英]old theme in 4.0+ app
I've created a spinner in my activity and when i run my app on my Jelly Bean device the theme of the spinner is like 2.x, how can i get the ICS one? 我在活动中创建了一个微调器,当我在Jelly Bean设备上运行应用程序时,微调器的主题就像2.x,如何获得ICS?
Here's my spinner code : 这是我的微调代码:
<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" />
As you can see I tried to set the global style "Holo" but no results.. 如您所见,我尝试设置全局样式“ Holo”,但没有结果。
I had the same problem with a NumberPicker
but can't remember how I fixed it. 我在使用NumberPicker
遇到了同样的问题,但是不记得如何解决它。
style="@android:style/Theme.Holo"
This is not the solution. 这不是解决方案。 You won't have a fallback on pre HC devices . 您将不会在HC之前的设备上遇到任何麻烦 。 You need to declare a Theme for your whole application if you want to use the holo theme in your whole app for HC+(I assume this is what you want to have). 如果要在整个应用程序中使用HC +的全息主题,则需要为整个应用程序声明一个主题(我想这就是您想要的)。
In your Manifest: 在您的清单中:
android:theme="@style/MyTheme"
values/styles.xml: values / styles.xml:
<style name="MyTheme" parent="android:Theme.Light">
</style>
values-v11/styles.xml: values-v11 / styles.xml:
<style name="MyTheme" parent="android:Theme.Holo.Light">
</style>
Now you'll have a dropdown spinner on HC+(and also other holo widgets of course) 现在,您将在HC +上有一个下拉菜单(当然还有其他全息控件)
However if you just want to have the spinner to be "holofied" you can do this: 但是,如果您只想让微调框“被镂空”,则可以执行以下操作:
<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" />
values/styles.xml: values / styles.xml:
<style name="MySpinner" parent="android:Widget.Spinner">
</style>
values-v11/styles.xml: values-v11 / styles.xml:
<style name="MySpinner" parent="android:Widget.Holo.Spinner">
</style>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.