为了让我的 android 识别正确的版本,我必须将我的 themes.xml 放在什么目录中?
我有两个版本的 themes.xml。一种用于平板电脑。另一个用于大屏幕手机。我把一个用于平板电脑的放在文件夹 res\values-v11\themes.xml 中,另一个放在 res\values\themes.xml 中
不幸的是有些东西不起作用。我在每个具有不同颜色的文件中为 textViews 定义了一个 textColor,这样我就可以识别操作系统在不同手机上选择的文件。它在装有 android 3.2 的 xoom 平板电脑上完美运行。在带有 2.3.5 的 galaxy s2 上它不起作用。
我错过了什么?
以下是我使用的样式: 平板电脑:
<style name='MyTheme' parent='android:Theme.Holo.Light'>
<style name='MyAutoComplete.red' parent='@style/MyAutoComplete'>
<item name='textColor'>@color/red</item>
</style>
非平板电脑:
<style name='MyTheme' parent='android:Theme.Light.NoTitleBar'>
<style name='MyAutoComplete.blue' parent='@style/MyAutoComplete'>
<item name='textColor'>@color/blue</item>
</style>
最佳答案
因为您的要求是通过 textView 的颜色跟踪操作系统版本。
我有以下建议。 (颜色仅供引用,可自行更改)
- res/values -> Yellow Color//Phone using 2.3.* or before
- res/values-v11 -> Red Color//Phone using 3.0 or later
- res/values-xlarge -> Green Color//Tablet using 2.3.* or before
- res/values-xlarge-v11 -> 蓝色//使用 3.0 或更高版本的平板电脑
所以 Xoom 应该显示蓝色,S2 (2.3.*) 应该显示黄色,Galaxy nexus 应该显示红色。
关于android - 我在哪里放置 themes.xml?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9787920/