的minSdkVersion = 7 TargetSDKVersion = 17Android:如何针对不同的Android版本使用不同的主题?
如果用户具有SDKVersion 11或更高我喜欢设置主题Theme.Holo.Light。 它在这里不适用于我。当我启动了3.1设备上的应用程序,它只是使用了Theme.Light:
同样的,当我在设备上运行此应用程式版本低于3.1
我Folderstructure:
清单:
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/MyTheme" >
个
值-V11:
<resources>
<!--
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="@android:style/Theme.Light">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
</style>
<!-- Application theme. -->
<style name="AppTheme" parent="@android:style/Theme.Light">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>
<style name="MyTheme" parent="@android:style/Theme.Holo.Light">
<!-- Any customizations for your app running on devices with Theme.Holo here -->
</style>
其它数值的文件夹:
<resources>
<!--
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="@android:style/Theme.Light">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
</style>
<!-- Application theme. -->
<style name="AppTheme" parent="@android:style/Theme.Light">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>
<style name="MyTheme" parent="@android:style/Theme.Light">
<!-- Any customizations for your app running on devices with Theme.Holo here -->
</style>
我该如何正确使用它?
真诚 马尔科Seiz
我这样做,但它仍然显示旧的主题,而不是我的Android 4.1和3.1设备 –
上的全息主题你删除重复? – Ahmad
是的,我做到了。我找出了错误。我必须为一种语言创建两个文件夹。对于德语:values-de和values-de-v11和英语相同......现在可以运行:)感谢您的帮助和提示! –