4

开发者工具:面向 Java 开发者的 Eclipse IDE Juno Release+Android2.2+ADT-21.0.1.zip

使用:颜色/tab_color_text_shadow:

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">

    <item android:state_pressed="true" android:color="#ffffff"/>
    <item android:state_focused="true" android:color="#ffffff"/>
    <item android:state_checked="true" android:color="#ffffff"/>
    <item android:color="#f75893"/>

</selector>

值/样式.xml:

<style name="main_tab_bottom">
 <item name="android:shadowColor">@color/tab_color_text_shadow</item>
 <item name="android:shadowDy">2</item>
 <item name="android:shadowRadius">1</item>
</style>



<RadioButton xmlns:android="http://schemas.android.com/apk/res/android"
    style="@style/main_tab_bottom"
    android:layout_marginTop="2dip"
    android:drawableTop="@drawable/exam_menu"
    android:tag="radio_button1"
    android:text="检查"
    android:textStyle="bold" />

问题:为什么“android:shadowColor”不支持“选择器”?

亚行错误报告:

02-19 10:41:23.650: E/AndroidRuntime(29865): Caused by: java.lang.NumberFormatException: Invalid int: "res/color/tab_color_text_shadow.xml"
02-19 10:41:23.650: E/AndroidRuntime(29865):    at java.lang.Integer.invalidInt(Integer.java)
02-19 10:41:23.650: E/AndroidRuntime(29865):    at java.lang.Integer.parse(Integer.java)
02-19 10:41:23.650: E/AndroidRuntime(29865):    at java.lang.Integer.parseInt(Integer.java)
02-19 10:41:23.650: E/AndroidRuntime(29865):    at com.android.internal.util.XmlUtils.convertValueToInt(XmlUtils.java)
02-19 10:41:23.650: E/AndroidRuntime(29865):    at android.content.res.TypedArray.getInt(TypedArray.java)
02-19 10:41:23.650: E/AndroidRuntime(29865):    at android.widget.TextView.<init>(TextView.java)
02-19 10:41:23.650: E/AndroidRuntime(29865):    at android.widget.Button.<init>(Button.java)
02-19 10:41:23.650: E/AndroidRuntime(29865):    at android.widget.CompoundButton.<init>(CompoundButton.java)
02-19 10:41:23.650: E/AndroidRuntime(29865):    at android.widget.RadioButton.<init>(RadioButton.java)
02-19 10:41:23.650: E/AndroidRuntime(29865):    at android.widget.RadioButton.<init>(RadioButton.java)

已经发布到 android 项目,问题 49793

4

0 回答 0