老主题4.0+应用 [英] old theme in 4.0+ app
问题描述
我在我的活动创建一个微调,当我我的果冻豆设备上运行我的应用程序微调的主题是像2.x的,我怎么能得到ICS的?
下面是我的飞旋code:
<微调
机器人:ID =@ + ID / spinnermap
风格=@安卓风格/ Theme.Holo
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:layout_alignParentLeft =真
机器人:layout_centerVertical =真/>
正如你可以看到我试图设置全局样式河洛,但没有结果。
我有同样的问题 NumberPicker
,但不记得我怎么固定它。
风格=@安卓风格/ Theme.Holo
这是不是解决办法。 您将不会对pre HC设备后备。
你需要声明一个主题为整个应用程序,如果你想使用全息主题在你的整个应用程序的HC +(我想这是你想要什么有)。
在你的清单:
安卓主题=@风格/ MyTheme的
价值观/ styles.xml:
<样式名称=MyTheme的父=机器人:Theme.Light>
< /风格>
值-V11 / styles.xml:
<样式名称=MyTheme的父=机器人:Theme.Holo.Light>
< /风格>
现在你将有HC +下拉微调(也当然其他部件全息)
不过,如果你只是想有微调是holofied你可以这样做:
<微调
机器人:ID =@ + ID / spinnermap
风格=@风格/ MySpinner
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:layout_alignParentLeft =真
机器人:layout_centerVertical =真/>
价值观/ styles.xml:
<样式名称=MySpinner父=机器人:Widget.Spinner>
< /风格>
值-V11 / styles.xml:
<样式名称=MySpinner父=机器人:Widget.Holo.Spinner>
< /风格>
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?
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..
I had the same problem with a NumberPicker
but can't remember how I fixed it.
style="@android:style/Theme.Holo"
This is not the solution. You won't have a fallback on pre HC devices. 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).
In your Manifest:
android:theme="@style/MyTheme"
values/styles.xml:
<style name="MyTheme" parent="android:Theme.Light">
</style>
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)
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:
<style name="MySpinner" parent="android:Widget.Spinner">
</style>
values-v11/styles.xml:
<style name="MySpinner" parent="android:Widget.Holo.Spinner">
</style>
这篇关于老主题4.0+应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!