मुझे लगता है कि क्या हो रहा है यह है कि चूंकि आप डिफ़ॉल्ट टेक्स्ट रंग को ओवरराइड कर रहे हैं, इसलिए यह अन्य टेक्स्ट रंग शैलियों को विरासत में नहीं मिला है। इसके लिए ColorStateList बनाने का प्रयास करें और रंग के बजाय टेक्स्ट रंग विशेषता को सेट करें।
एक रंग फ़ाइल में (उदाहरण के लिए रेस/रंग/example.xml):
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false" android:color="@color/disabled_color" />
<item android:color="@color/normal_color"/>
</selector>
फिर अपने लेआउट में
:
<TextView
android:text="whatever text you want"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/example" />
ध्यान दें, मैं इस एक समय में नहीं किया है और मैं इसे स्मृति से बहुत कुछ लिख रहा हूं, इसलिए इसे थोड़ा tweaking की आवश्यकता हो सकती है। कलरस्टेटलिस्ट डॉक्स (उपरोक्त लिंक) में रंग XML फ़ाइल के लिए एक अधिक fleshed-out उदाहरण है।
स्रोत
2009-08-29 01:32:37
यहाँ समाधान है: डी http://stackoverflow.com/questions/4692642/android-customized-button-changing-text-color – cesards
आप मैन्युअल रूप से पाठ का रंग जो कुछ भी करने के लिए आप चाहते हैं सेट करना होगा। कम से कम यही मुझे करना है। – MattC