【发布时间】:2011-09-16 13:50:08
【问题描述】:
我正在尝试测试一种制作主题的方法,但我使用的方法并没有给我预期的结果。这是我的设置:
drawable/dummy.xml
<?xml version="1.0" encoding="utf-8"?>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/icon" />
值/mythemes.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="MyOrange" parent="android:style/Theme">
<item name="@drawable/dummy">@style/imgOrange</item>
</style>
<style name="MyBlue" parent="android:style/Theme">
<item name="@drawable/dummy">@style/imgBlue</item>
</style>
<style name="imgOrange">
<item name="android:src">@drawable/orange</item>
</style>
<style name="imgBlue">
<item name="android:src">@drawable/blue</item>
</style>
</resources>
layuot/main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" android:orientation="vertical">
<ImageView android:id="@+id/imageView1"
android:src="@drawable/dummy"
android:layout_height="wrap_content"
android:layout_width="wrap_content">
</ImageView>
</LinearLayout>
我没有收到任何错误,但它也没有改变主题。
我也尝试使用一种样式作为“虚拟”,但它做同样的事情。
有什么想法/解释吗?
【问题讨论】:
标签: android coding-style themes nested