मैंने कुछ स्टाइल संसाधनों को परिभाषित किया है जिनमें एक परिभाषित टेक्स्टकॉलर के साथ टेक्स्टएपियरेंस शामिल है। मैं फिर कुछ टेक्स्ट व्यू और बटन पर शैलियों को लागू करता हूं। सभी शैलियों टेक्स्टव्यू के साथ आती हैं, लेकिन बटन नहीं। किसी कारण से, टेक्स्ट रंग विशेषता प्रदर्शित नहीं हो रही है। क्या यह एक बग है, या क्या मुझे बटन के मामले में कुछ याद आ रहा है?टेक्स्टकॉलर को टेक्स्ट व्यू पर लागू किया जा रहा है, लेकिन बटन नहीं?
यहाँ शैली परिभाषा है:
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<style name="TestApp">
</style>
<!-- Text Appearances -->
<style name="TestApp.TextAppearance">
<item name="android:typeface">sans</item>
<item name="android:textStyle">bold</item>
<item name="android:textSize">16px</item>
<item name="android:textColor">#6666FF</item>
</style>
<!-- Widget Styles -->
<style name="TestApp.Widget">
<item name="android:layout_margin">3sp</item>
</style>
<style name="TestApp.Widget.Label">
<item name="android:textAppearance">@style/TestApp.TextAppearance</item>
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
</style>
<style name="TestApp.Widget.Switch">
<item name="android:textAppearance">@style/TestApp.TextAppearance</item>
<item name="android:layout_width">100px</item>
<item name="android:layout_height">100px</item>
</style>
</resources>
और यहाँ लेआउट जहाँ मैं उन्हें लागू करने का प्रयास है:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<TextView
style="@style/TestApp.Widget.Label"
android:text="This is my label." />
<TextView
style="@style/TestApp.Widget.Label"
android:text="This is my disabled label."
android:enabled="false" />
<Button
style="@style/TestApp.Widget.Switch"
android:text="This is my switch." />
<Button
style="@style/TestApp.Widget.Switch"
android:text="This is my disabled switch."
android:enabled="false" />
</LinearLayout>
मुझे सही समस्या थी और मैंने टेक्स्ट को ओवरराइड करने का हल किया। ऐसा लगता है कि बटन टेक्स्ट एप्योरेंस विशेषता को अनदेखा करते हैं। –