2012-08-05 11 views
5

मैं शैली को अपनी शैली के साथ बदलकर टैब विजेट को कस्टमाइज़ करना चाहता हूं। आइटम मैं बदलने के लिए जा रहा हूँ इस प्रकार है:कोई संसाधन नहीं मिला जो दिए गए नाम से मेल खाता है: attr 'android: tabLayout'

<item name="android:tabLayout">@android:layout/tab_indicator_holo</item> 

लेकिन मैं यह त्रुटि आई: कोई संसाधन में पाया गया कि दिए गए नाम से मेल खाता: attr 'एंड्रॉयड: tabLayout'

मैं माता-पिता की स्थापना की है इस तरह की शैली:

<style name="customTabWidget" parent="@android:style/Widget.Holo.TabWidget"> 

परियोजना का निर्माण लक्ष्य: Android 4.0

मैं भी परियोजना को साफ कर लेंगे लेकिन त्रुटि अभी भी निकलती है। त्रुटि को कैसे ठीक करें?

अग्रिम धन्यवाद।

+1

'tabLayout' एक गैर सरकारी विशेषता रही है। यहां बग ट्रैकिंग है: https://code.google.com/p/android/issues/detail?id=65832 यदि आप TabWidget को कस्टमाइज़ करना चाहते हैं तो आपको [TabSpec.setIndicator] (http का उपयोग करके प्रोग्रामेटिक रूप से ऐसा करना पड़ सकता है : //developer.android.com/reference/android/widget/TabHost.TabSpec.html#setIndicator (android.view.View))। – Klaus

उत्तर

2

मुझे एक ही समस्या का सामना करना पड़ा। समाधान का कम से कम हिस्सा टैबलाइट विशेषता को res/values ​​/ attrs.xml में जोड़ना है। यहाँ TabWidget शैलियों की परिभाषा, एंड्रॉयड -16 मंच से कॉपी की गई है (नोटिस अंत में tabLayout विशेषता):

<declare-styleable name="TabWidget"> 
    <!-- Drawable used to draw the divider between tabs. --> 
    <attr name="divider" /> 
    <!-- Determines whether the strip under the tab indicators is drawn or not. --> 
    <attr name="tabStripEnabled" format="boolean" /> 
    <!-- Drawable used to draw the left part of the strip underneath the tabs. --> 
    <attr name="tabStripLeft" format="reference" /> 
    <!-- Drawable used to draw the right part of the strip underneath the tabs. --> 
    <attr name="tabStripRight" format="reference" /> 
    <!-- Layout used to organize each tab's content. --> 
    <attr name="tabLayout" format="reference" /> 
</declare-styleable> 

जब से तुम अधिभावी कर रहे हैं, आप भी बदलना चाहते हैं जाएगा:

<item name="android:tabLayout">... 

रहे हैं:

<item name="tabLayout">... 
+0

यह समाधान मेरी मदद नहीं करता है। मुझे और कुछ और करना चाहिए जो इस उत्तर से नहीं बताया गया था? –

+0

मैंने थोड़ी देर पहले उस उत्तर को लिखा था। अब इसे देखकर, कुछ भी दिमाग में नहीं आता है। माफ़ कीजिये! –

+0

यह समाधान नहीं है। यह केवल संकलन कोड की अनुमति है। और कुछ नहीं। एंड्रॉइड कस्टम विशेषताओं का उपयोग नहीं करेगा क्योंकि इसके बारे में पता नहीं है। – Enyby

संबंधित मुद्दे

 संबंधित मुद्दे